Search found 4506 matches

by aGerman
03 Oct 2011 11:24
Forum: DOS Batch Forum
Topic: echo multiple lines + redirection
Replies: 7
Views: 9076

Re: echo multiple lines + redirection

I see. @echo off &setlocal set "outp=file(1).bat" set "wavi_path=c:\folder(1)\whatever.ext" setlocal enabledelayedexpansion >"%outp%" ( echo rem are using: !wavi_path! ) endlocal Note that I used enabledelayedexpansion AFTER setting the variable values. Otherwise ex...
by aGerman
03 Oct 2011 11:02
Forum: DOS Batch Forum
Topic: Move command help!
Replies: 2
Views: 3074

Re: Move command help!

1. Because space is one of the standard delimiters in batch AND that's the syntax for MOVE
2. Enclose the entire path in quotes like

Code: Select all

move "c:\path with spaces\file.ext" "c:\path with more spaces\new file name.ext"


Regards
aGerman
by aGerman
03 Oct 2011 10:43
Forum: DOS Batch Forum
Topic: How to Delet all video file format using batch file
Replies: 7
Views: 6927

Re: How to Delet all video file format using batch file

@echo off &setlocal :: Rootfolder of files to delete set "root=D:\somewhere" :: extensions of files you want to delete :: you could add more extensions (space separated) set "extensions=*.avi *.mpg *.mp4 *.flv *.wmv" cd /d "%root%" ||goto :eof for /f "delims=&...
by aGerman
03 Oct 2011 10:19
Forum: DOS Batch Forum
Topic: echo multiple lines + redirection
Replies: 7
Views: 9076

Re: echo multiple lines + redirection

Could you give an example variable content, which doesn't work?! I tried that without any problems: @echo off &setlocal set "outp=file(1).bat set "wavi_path=c:\folder(1)\whatever.ext" set "neroAAC_path=c:\folder(2)\whatever.ext" >"%outp%" ( echo :aac echo "...
by aGerman
02 Oct 2011 16:08
Forum: DOS Batch Forum
Topic: can you set multiple lines into one variable?
Replies: 4
Views: 4244

Re: can you set multiple lines into one variable?

It's possible and you will find a few examples in this forum. @echo off :: Create LineFeed character :::::::::::::: set lf=^ :: Two empty lines above are neccessary! :: set "line1=Hello" set "line2=World!" setlocal enabledelayedexpansion :: merge both variables set "var=!lin...
by aGerman
02 Oct 2011 06:55
Forum: DOS Batch Forum
Topic: What was cmd programmed in?
Replies: 2
Views: 3326

Re: What was cmd programmed in?

Even if it is a bit off topic ... I'm virtually certain that the cmd is written in C. If you open cmd.exe in a HEX editor you will find some hints. One of the important is that msvcrt.dll is linked. This is the C-runtime. Also in relation to some plain text phrases you will often find the combinatio...
by aGerman
01 Oct 2011 11:37
Forum: DOS Batch Forum
Topic: I need help with this code!!
Replies: 4
Views: 4405

Re: I need help with this code!!

The result of %random% %% 10 is a number between 0 and 9. You should add 1. Don't use numbers in the beginning of a variable name! You forgot to close the parentheses. @echo off &setlocal set /a n1=%random% %% 10 + 1 set /a n2=%random% %% 10 + 1 <file1.txt ( for /l %%i in (1,1,%n1%) do set /p &q...
by aGerman
01 Oct 2011 06:48
Forum: DOS Batch Forum
Topic: use %random% to echo a number between 200 and 400
Replies: 2
Views: 3216

Re: use %random% to echo a number between 200 and 400

' Just don't get addicted to macros I'm afraid it's difficult to understand for a beginner I'll try to explain how such a calculation could look like: @echo off &setlocal set /a n1=200 set /a n2=400 :: difference between n1 and n2 set /a n3=n2-n1 :: check whether n1 was less than n2 if %n3% lss...
by aGerman
01 Oct 2011 06:03
Forum: DOS Batch Forum
Topic: replacing the whole line based on substring of it.
Replies: 12
Views: 10602

Re: replacing the whole line based on substring of it.

You could try something like that: @echo off &setlocal set "file=makfi.txt" set "dest=new.txt" set "search=the current user logged" set "replace=whatever!" setlocal enabledelayedexpansion for /f "delims=:" %%a in ('findstr /nc:"!search!"...
by aGerman
26 Sep 2011 12:21
Forum: DOS Batch Forum
Topic: Create .bks file using batch script
Replies: 2
Views: 3718

Re: Create .bks file using batch script

It's quite difficult to create unicode files but it's possible. That's the way I would create such a file: @echo off &setlocal set "bksFile=%userprofile%\Local Settings\Application Data\Microsoft\Windows NT\NTbackup\Data\test.bks" :: save the current codepage for /f "tokens=2 deli...
by aGerman
25 Sep 2011 05:44
Forum: DOS Batch Forum
Topic: Vista/Windows7 - run non-elevated from elevated mode
Replies: 2
Views: 3363

Re: Vista/Windows7 - run non-elevated from elevated mode

Vista / Win7 has the UAC (User Account Controll). You can adjust its level.
Also, if you have the permissions, you could right click your batch file and "run as administrator".

Regards
aGerman
by aGerman
25 Sep 2011 05:35
Forum: DOS Batch Forum
Topic: Ps3 doesnt want to install update for game?
Replies: 3
Views: 3962

Re: Ps3 doesnt want to install update for game?

It's not only off topic, it's also advertising.
Links removed, user banned.

Regards
aGerman
by aGerman
25 Sep 2011 05:28
Forum: DOS Batch Forum
Topic: My very own .doc file maker
Replies: 2
Views: 3679

Re: My very own .doc file maker

A text file with extension .doc is never a Word document.

Regards
aGerman
by aGerman
19 Sep 2011 18:31
Forum: DOS Batch Forum
Topic: Help with set /a command
Replies: 15
Views: 17762

Re: Help with set /a command

The variable can equal 0 if you would write the redirection in an opposite way:

Code: Select all

>>numbers.txt echo %x%

Also there is an operator += to increment a number:

Code: Select all

set /a x+=1

BTW: A FOR /L loop would be a better solution.

Regards
aGerman
by aGerman
19 Sep 2011 18:21
Forum: DOS Batch Forum
Topic: Batch with files as input
Replies: 8
Views: 7466

Re: Batch with files as input

Yes, this is possible.

Code: Select all

@echo off
javac "%~1"
java "%~n1"
pause

You could replace javac and java by echo (or simly prepend an echo to these lines) to display what came in.

Regards
aGerman