weam elsahar
weam elsahar

Reputation: 31

How to redirect Windows cmd output to a text file?

I am trying to monitor the cmd output of a certain executable .exe and use it for another process running at the same time.

The problem is that all cmd redirecting functions ( '>','>>','<' and '|') would only redirect the output after a successful return of the last command.

What I wanted to do is to generate some kind of streaming log of my cmd.

Upvotes: 3

Views: 23033

Answers (3)

Buddy Happy
Buddy Happy

Reputation: 5

Windows 20H2: Redirection works fine when logged in as true administrator but will NOT work when logged in as a created administrative user. I have used it for years to redirect the output of a multi target backup system using Hobo copy to put the console output in a log file. I have never been able to get it to work successfully in Windows 10 ver 19 or 20 on a created administrative user.

Upvotes: -2

SolveProblem
SolveProblem

Reputation: 91

You can prefix the command with "cmd /c" to start a new command prompt, and redirect the output of the command prompt:

cmd /c YOUR CODE > TextFileName.txt

Note : Use ONLY single greater than (>)

Since the output of cmd is going to TextFileName.txt.

Whereas this misses the error output, so you are not able to see : Request to UnKnown timed-out for each failed address.

Upvotes: 0

Wander3r
Wander3r

Reputation: 1881

You can run in your process in background by using

start /b something.exe > somefile.txt

Upvotes: 5

Related Questions