Matthew Wai
Matthew Wai

Reputation: 1002

How to write the output into a file and also display the same output on the CMD window

SFC /scannow

If the above is run, the output will be displayed on the CMD window.
If the following is run, the output will be written into a file but will not be displayed on the CMD window.

SFC /scannow >%USERPROFILE%\Desktop\Output.txt

Is it possible to write the output into a file and display the same output on the CMD window at the same time without having to run SFC /scannow twice?

Upvotes: 0

Views: 784

Answers (1)

andaris
andaris

Reputation: 205

If you can also use PowerShell instead of cmd.exe, you can use the (Unix-inspired) tee command to copy the standard output (STDOUT) to a file.

SFC /scannow | tee %USERPROFILE%\Desktop\Output.txt

Upvotes: 1

Related Questions