Batch processing combined with tee command, dual output of screen and log

At the same time that batch processing is required to open the microservice window, you must also write to the log and start using redirection>, but the redirection is directly written to the log file, the window no longer displays the output,
check it online, you can use the linux command tee on window After downloading tee.exe and copying it to the C: \ Windows \ System32 directory, you can use it directly. Cmd opens a window and enters tee --help to
output some help about tee.
Here are some ideas about the tee command:
start "" cmd / k "echo hello | tee running.log" A
new window will display the hello command, and a running.log file will also be generated in the current directory, which also contains hello
start "" cmd / k "echo hello && echo world | tee running.log" The
new window will show hello world, but there is only world in the log (regardless of the output line feed display).
Change and adjust it. If I use the command to be output ( ) Enclosed, followed by tee will
start "" cmd / k "(echo hello && echo world) | tee running.log"
window normally output hello world
log file also contains hello world

Attached to the unix tool set UnixUtils under Windows:
UnxUtils.zip download address:
http://pan.baidu.com/s/1o6BNnKY
UnxUtils.zip There is also an update package, UnxUpdates.zip download address:
http://pan.baidu. After
downloading UnxUtils and UnxUpdates from com / s / 1o6NY1E6 , unzip it to your own folder and add the absolute address of the / usr / local / wbin folder to
my computer (right click)-> Properties-> Advanced-> Environment Variables-> System variable-> path value
like this, you can use similar linux command in cmd window at any time.

Of course, some commands are the same as the command names of Windows itself. The system will give priority to the commands that come with Windows. You can consider modifying the command name of Windows or deleting it directly.

Guess you like

Origin blog.51cto.com/13236892/2487559