user3801813
user3801813

Reputation: 61

Save multiple command results to txt file

I have given a bat file that I should run on development server which does some updates.

It has multiple commands and I would like to keep the results in txt file.

Should I add after each command >> result.txt or I can add it somewhere in the end of bat file and everything will be written in that?

Upvotes: 5

Views: 5810

Answers (1)

MiiinimalLogic
MiiinimalLogic

Reputation: 818

You have four options:

  • Run the batch file at the command line like: myBat.bat >> outPut.txt

  • Script the above in another batch file and run that

  • Insert the >> after each command ( Note: the >> appends to file, while > overrides existing text output file)

  • Enclose all relevant lines in parentheses and script >> result.txt once at the end of the script

Upvotes: 4

Related Questions