[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Redirect screen outputs to a file

Posted on 2002-07-29
5
Medium Priority
?
420 Views
Last Modified: 2010-04-13
I have a batch file which I want to run on a periodic basis. The commands and programs in the batch file will print to the screen. Is there any way to redirect the screen outputs to a single file? I want the outputs to be appended to the file every time the batch file is run.

Thanks!
0
Comment
Question by:yongsing
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 9

Accepted Solution

by:
schmiegu earned 200 total points
ID: 7184732
dir > dir.txt

creates a dir.txt with a listing of the directory you run it in

dir >> dir.txt appends the listing of the dir to dir.txt, if it exists or creates a new one, if not.

cmd1 1>success.txt 2>error.txt redirects normal output to success.txt, errors to errot.txt

For more information search Windows 2000 help for redirection.
0
 
LVL 9

Author Comment

by:yongsing
ID: 7184873
Instead of redirecting at each command, is there any way to specify, at the beginning of the batch file, to redirect all outputs from all commands to the file?

So instead of:
command1 >> output.txt
command2 >> output.txt
command3 >> output.txt

I have:
"Redirection Command"
command1
command2
command3
0
 
LVL 3

Expert Comment

by:tfl
ID: 7184920
not - sadly there is no built in utility that does this.

Each of the commands is built to write to stdio - and this can then be piped to another output using ">" or ">>".

Sorry.

I suppose you could write a wrapper for the command that did the redirection, but just putting in ">> file.txt" is probably quicker.

Thomas
0
 
LVL 9

Expert Comment

by:schmiegu
ID: 7185253
I once had a DOS utility, that captured command output (there were some commands that didn't work with standard redirection), but I have no idea, if there exists one to do this in NT.
0
 
LVL 9

Author Comment

by:yongsing
ID: 7185396
I'll accept this solution since it's the next best thing to what I wanted. Thanks for your helps, guys!
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
A walk-through example of how to obtain and apply new DID phone numbers to your cloud PBX enabled users that are configured in Office 365. Whether you have 1, 10 or 100+ users in your tenant, it's quite easy to get them phone-enabled and making/rece…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question