Search found 187 matches

by Fawers
14 Jul 2012 18:31
Forum: DOS Batch Forum
Topic: Automatically merge pdf based on file existence
Replies: 26
Views: 32769

Re: Automatically merge pdf based on file existence

It looks better if you use "EQU 3" instead of "GTR 0", just like abc said.

And, yes, you'll have to change the code if the names are not "report x.pdf", where x can be 1, 2, or 3.
by Fawers
14 Jul 2012 12:06
Forum: DOS Batch Forum
Topic: Automatically merge pdf based on file existence
Replies: 26
Views: 32769

Re: Automatically merge pdf based on file existence

To see if they are there, you just have to use IF EXIST statements. @echo off pushd "%pdfpath%" ::%pdfpath% should be the path containing your PDFs set pdf=0 for %%n in (1 2 3) do if exist "report %%n.pdf" set /a pdf+=1 if %pdf% GTR 0 (echo There are %pdf% Report files in the fol...
by Fawers
14 Jul 2012 11:54
Forum: DOS Batch Forum
Topic: Automatically merge pdf based on file existence
Replies: 26
Views: 32769

Re: Automatically merge pdf based on file existence

I don't know if copy can do the trick, but try it.

Code: Select all

copy /b report*.pdf "Main Report.pdf"

Edit:
Nope, won't work.
by Fawers
13 Jul 2012 15:23
Forum: DOS Batch Forum
Topic: Delete in ALL Dirs
Replies: 4
Views: 4825

Re: Delete in ALL Dirs

What about delete all files that DO NOT match a list of extensions? for /f "delims=" %%a in ('dir /b /s /a') do ( if /i "%%~xa" NEQ ".ext" del /a /q /f "%%a" ) Edit Sorry, I misread your last line. You want a list of extensions. @echo off ::set your extension...
by Fawers
09 Jul 2012 00:14
Forum: DOS Batch Forum
Topic: Advanced Batch features via auxiliary .exe programs
Replies: 76
Views: 200731

Re: Advanced Batch features via auxiliary .exe programs

StrLen.exe is going to help me a lot. Thank you very much, Antonio.
by Fawers
08 Jul 2012 19:23
Forum: DOS Batch Forum
Topic: How to call the oldest batch file from another batch file.
Replies: 4
Views: 4743

Re: How to call the oldest batch file from another batch fil

Alternatively, you can use CALL or START [/WAIT]. These make your code more readable. ;)
by Fawers
08 Jul 2012 14:32
Forum: DOS Batch Forum
Topic: How to call the oldest batch file from another batch file.
Replies: 4
Views: 4743

Re: How to call the oldest batch file from another batch fil

Maybe this piece of code will help you.

Code: Select all

pushd "C/app/outbound"
for /f "delims=" %%a in ('dir /b /o-d *.bat') do set "oldBat=%%~fa"
popd
echo oldBat == %oldBat%
pause

(untested)
Insert these lines in your caller.bat and tell us if it does what you want it to.
by Fawers
07 Jul 2012 17:21
Forum: DOS Batch Forum
Topic: Help!!!
Replies: 14
Views: 11125

Re: Help!!!

Bulleyeaccuracy, no. The brackets enclose the command(s) after the IF condition and before the ELSE. e.g. if %minecraftsaver%==all (goto minecraftall) else goto minecraftbackup1 Also, I answered what will probably solve your problem on my first post. Try this if /i "%minecraftsaver%" == &q...
by Fawers
06 Jul 2012 20:13
Forum: DOS Batch Forum
Topic: Help!!!
Replies: 14
Views: 11125

Re: Help!!!

i guess i could say i am ok at batch coding, but i have no idea what you ment by giving me the help for the if command. What he meant was probably referring to that line of code: if %minecraftsaver%==all goto minecraftall else goto minecraftbackuperror , and this part on the help: IF EXIST filename...
by Fawers
06 Jul 2012 20:08
Forum: DOS Batch Forum
Topic: Help!!!
Replies: 14
Views: 11125

Re: Help!!!

Try this

Code: Select all

if /i "%minecraftsaver%" == "all" (goto minecraftall) else goto minecraftbackuperror
by Fawers
01 Jul 2012 16:57
Forum: DOS Batch Forum
Topic: Wait for Few Seconds before Executing a Command
Replies: 4
Views: 5678

Re: Wait for Few Seconds before Executing a Command

foxidrive wrote:Choice is available in Vista and Windows 7 again I think.

That's right. I don't even know why they took it off XP. :(
by Fawers
30 Jun 2012 23:38
Forum: DOS Batch Forum
Topic: Multiple results of dir /b /s
Replies: 8
Views: 7974

Re: Multiple results of dir /b /s

What does the help for makecab show? Wouldn't you rather use winRar or 7zip?
by Fawers
30 Jun 2012 23:36
Forum: DOS Batch Forum
Topic: Wait for Few Seconds before Executing a Command
Replies: 4
Views: 5678

Re: Wait for Few Seconds before Executing a Command

Well, you can do it with choice. But choice is not available on XP (unless you download it). With choice.exe, you can set a default answer and a timeout; if the timer reaches 0, this default option will be chosen. Download choice.exe from somewhere, put it in \windows\system32 (i put it there) and t...
by Fawers
30 Jun 2012 22:37
Forum: DOS Batch Forum
Topic: Multiple results of dir /b /s
Replies: 8
Views: 7974

Re: Multiple results of dir /b /s

Hey there. Try md tempFolder for /f "delims=" %%a in (temp.txt) do copy /b "%%a" tempFolder set /P file_name=What would you like to name your archive? makecab.exe tempFolder\* "%userprofile%\Desktop\%file_name%.cab" del temp.txt instead of set /p TOOLOUTPUT= < temp.txt ...
by Fawers
28 Jun 2012 21:48
Forum: DOS Batch Forum
Topic: create an empty .txt file if the file doesnt exist
Replies: 9
Views: 21317

Re: create an empty .txt file if the file doesnt exist

PRO The fsutil doesn't overwrite an existing file. I believe your "type" and "rem" lines will also not overwrite if you append instead of write, yet would still create a 0-byte file if it doesn't exist already. >>"test 1.txt" type nul >>"test 3.txt" rem. Livi...