Is there a way to step through a .bat script? The thing is, I have a build script , which calls a lot of other scripts, and I would like to see what is the order in which th
Did you try to reroute the result to a file? Like whatever.bat >log.txt
You have to make sure that in this case every other called script is also logging to the file like >>log.txt
Also if you put a date /T and time /T in the beginning and in the end of that batch file, you will get the times it was at that point and you can map your script running time and order.
A quite frequent issue is that a batch script is run by double-clicking its icon. Since the hosting Command Prompt (cmd.exe
) instance also terminates as soon as the batch script is finished, it is not possible to read potential output and error messages.
To read such messages, it is very important that you explicitly open a Command Prompt window, manoeuvre to the applicable working directory and run the batch script by typing its path/name.
rem out the @ECHO OFF and call your batch file redirectin ALL output to a log file..
c:> yourbatch.bat (optional parameters) > yourlogfile.txt 2>&1
found at http://www.robvanderwoude.com/battech_debugging.php
IT WORKS!! don't forget the 2>&1...
WIZ
you can use cmd \k
at the end of your script to see the error. it won't close your command prompt after the execution is done
Or.... Call your main .bat file from another .bat file and output the result to a result file i.e.
runner.bat > mainresults.txt
Where runner.bat calls the main .bat file
You should see all the actions performed in the main .bat file now