|
Answer» Hi, can anyone tell me how to make a log of the actions of a batch FILE please?
I've written a batch file and someone told me that by putting >mike.log at the END of it in the command prompt screen this will work. Usually tho I just double click the batch file off an image server or desktop and this runs it. How would I hang it all together in command prompt?
Many thanks.You could try to add the redirection ( > mike.log) to the command line in the program properties screen.
Usually users add echo statements inside their batch files and redirect the output to a log file.
If redirection is used with programs that prompt the user, the prompts will go to the log and not be visible on the screen. Sort of like an invisible wait state.
Hope this helps. If you want to debug your batch file and your script does not require any input, you could simply disable the @ECHO OFF command in your batch file to @ECHO ON then, at the prompt, simply run your batch with redirection.
Example: TEST.BAT >DEBUG.LOG
Doing this will create a TEXT file with each command executed by per line. You would have to use NOTEPAD to replace the directory lines with ZERO string.
Example result:
D:\mediacntr\$OEM$\$$\System32>cls D:\mediacntr\$OEM$\$$\System32>REM Split all the requested users up into seperate variables.
D:\mediacntr\$OEM$\$$\System32>REM We do this because the FIND works only with single search strings.
D:\mediacntr\$OEM$\$$\System32>set user1=
D:\mediacntr\$OEM$\$$\System32>set user2=
D:\mediacntr\$OEM$\$$\System32>set user3=
D:\mediacntr\$OEM$\$$\System32>set user4=
Replace the PATH info "D:\mediacntr\$OEM$\$$\System32>" with a ZERO (no text) string under notepad.
|