简体   繁体   中英

Saving the output of a batch file in command prompt

Is there anyway to write the command windows output to a file? To have a transcript if you will.

Yes, for example, on the command prompt you can do this:

dir *.* > c:\temp\a.txt

This operation is called 'output redirection'. The output of the above command will go the named file and will overwrite it if it already exists with the results. You can find many examples on the net for that, example: Redirection.

In command prompt, use >> operator.

For example, If you type below command then output will be saved to output.txt file

dir > output.txt

If you type below then output will be appended to exist file.

dir >> output.txt

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM