Posts

Showing posts with the label batch-file

add command INSIDE batch file to generate text log (launched by double click)

add command INSIDE batch file to generate text log (launched by double click) Advanced thanks to anyone who is stopping by to read this. Here's my scenario: SCENARIO ISSUES Although the file and commands work perfectly for my needs, the results are too long for cmd (even after maximizing buffers in cmd settings); by the time the last command is executed, I can no longer scroll back up to the first commands -- cmd has purged them due to a space limitation. GOAL I would like a way for all of the above to continue as-is (even if I can't read all the way up in CMD) but also to add a command INSIDE the .bat file to SIMULTANEOUSLY output all results to a text file (exactly what appears onscreen: successes, failures, errors -- EVERYTHING) Does such a command exist? Also, if anyone knows a workaround to running out of space in cmd, I would love that too. Thanks again! < Such a command does not exist. You have to use tee, GNUWin or batch version. ...

Batch Script Iterative form

Batch Script Iterative form I have a batch script which : if both of the above statement is true then generate a success file. Below is my code which is working fine: SET /A file1=file2=Val=0 SET /A FileE=1 set /a flagname=1 for %%A in (*ABC*.txt) do set /a file1+=1 for %%A in (*XYZ*.txt) do set /a file2+=1 for %%i in ("*") do if exist "Processed%%~nxi" SET /A FileE=0 SET /A Val=%file1%*%file2%*%FileE% if %Val% EQU 1 ( echo SUCESS>Sucess.txt SET Flag=Sucess echo %Flag%) else ( if %file1% EQU 0 ( echo Missing ABC.txt files >> Error.txt) if %file1% GTR 1 ( echo More than 1 ABC.txt files >> Error.txt) if %file2% EQU 0 ( echo Missing XYZ.txt files >> Error.txt) if %file2% GTR 1 ( echo More than 1 XYZ.txt files >> Error.txt) (for %%i in ("*") do if exist "Processed%%~nxi" echo(File Exists in Processed Folder %%~i)>>Error.txt SET Flag=FAILURE echo %Flag%) My problem is how to transform above code to iterate over a lis...