9/4/2023 0 Comments Windows file copy logThat's because ">" captures "normal output" which has been sent to the STDOUT stream. Notice the error message "File Not Found" was shown on the screen when the script was run, and was not actually captured into the file. If I run the script and use redirection ( ">") to capture the output, I will see this C:\>a.cmd > log.txt I do this only to show what will happen with "error messages" when you run your script. Notice that in the test script, the first execution of the "dir" command is successful, and the second one fails. This is what happens when I run this batch script: C:\>a.cmd (tl dr version: use wintee, like this: script 2>&1 | wtee logfile.txt)įor this post, I will be using a small test batch file, but your script could be as big and complicated or as simple as you need: C:\>type off So, basically, it sounds like you want the output of a script to be captured to a file, and to also be able to see the output of the script on the screen while the script is running. In any case, I'm posting this answer in case there are others who find this question/answer helpful. If that is not what you meant, then it would have probably helped if that was explained better, perhaps with some sample output. Since you say the program is running and its output is being put into the file, I thought that you might have meant "displayed", instead of "executed". In my case I would need it executed and then logged into a file for later reference." it will put the output in a file but not actually execute it.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |