There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
access audio avg avg 8 bios blue screen boot bsod computer connection cpu crash css dell desktop dma driver drivers dvd email error excel explorer firefox firefox 3 freeze gimp graphics hard drive hardware hijackthis hjt install internet internet explorer itunes keyboard laptop macro malware monitor motherboard network networking outlook outlook 2003 outlook 2007 outlook express pio problem problems router seo server slow sound sp3 spyware trojan usb video virtumonde virus vista vundo windows windows vista windows xp winxp wireless
Software Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
Redirecting standard error/output


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

 
Thread Tools
cgjoker's Avatar
Senior Member with 205 posts.
 
Join Date: Aug 2003
08-Jul-2004, 11:51 AM #1
Redirecting standard error/output
Can anyone please tell me how to redirect standard error and output to a windows batch/command file? Id like to do it for the whole file, not command line by command line.

So rather than having >& for std. error and std. output after each command line in my batch file, I would just specify it once for all that happens within the batch file.

thanks.
codejockey's Avatar
Senior Member with 1,410 posts.
 
Join Date: Feb 2002
10-Jul-2004, 10:23 AM #2
Have you tried specifying the redirection on the command line when you invoke the program (i.e., program-name >& logfile.txt)? This takes all of the standard error and standard output and redirects it to a single file (logfile.txt). Note that a different syntax is required if you are using the bash or ksh on Linux/Unix; there, you would use: programe-name > logfile.txt 2>&1 to accomplish the same thing.

Hope this helps.
__________________
The slowest component still sits at the keyboard.
cgjoker's Avatar
Senior Member with 205 posts.
 
Join Date: Aug 2003
14-Jul-2004, 03:51 PM #3
so sorry... I thought I already replied to this
I ended up doing something similar to what you suggested.

Here is what I used:

set STDOUT=C:\Mail_file\stdout.txt
set STDERR=C:\Mail_file\stderr.txt
echo Begin at: 1>>%STDOUT% 2>>%STDERR%
time /T 1>>%STDOUT% 2>>%STDERR%
date /T 1>>%STDOUT% 2>>%STDERR%
Manual_Mail_ftp.bat 1>>%STDOUT% 2>>%STDERR%
echo End at:1>>%STDOUT% 2>>%STDERR%
time /T 1>>%STDOUT% 2>>%STDERR%
date /T 1>>%STDOUT% 2>>%STDERR%
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are Off
Refbacks are Off

You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 05:52 PM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.