Output the error log of CMD in windows to the txt file: use > > to log.txt

sometimes in Windows to run some CMD commands or command files: batch command files such as.bat,.cmd files,.exe files CMD window will flash back, there will be some error reasons, we would like to see, in order to targeted to solve the problem. At this time can think of is output error to the log file to preserve the view or record the screen software with high frame rate CMD window flash back inside displayed error information.

for now, I’m only going to talk about output to the log .

situation 1: run the command flash back directly in CMD.

solution: enter the command in the newly opened CMD window in the format: command > > log.txt

for example: ipconfig/all> > D:\test\log.txt is to output IP configuration information to the path D:\test\log.txt log file,

if the path is log.txt means output to the current directory,

like ipconfig/all> > Log.txt outputs logs to the C:\Windows\System32 directory, and the program that runs the ipconfig/all command ipconfig.exe is in the C:\Windows\System32 directory

Situation 2: run the.exe (.cmd,.bat, etc.) program

in CMD

solution: in the directory where exe program is located, hold Shift and right-click in the blank, enter the command in the open CMD window, the format is: exe program name > > log.txt

log output path as in scenario 1.

note: double-clicking the.exe,.cmd,.bat file will have the same effect as typing the program name on the CMD command line in scenario 2 to start the program.

USES scenario 2 to process and run visible exe,.cmd,.bat files. It has more advantages than double-clicking to run them. It is more controllable in the whole process, and more parameters can be added to the command line to assist running these files, such as making the run log TXT file.

Read More: