Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Writing to files from a DOS batch file

Status
Not open for further replies.

PFunkster

Technical User
Jul 24, 2001
4
US
I've got a batch file which calls another file to start a server. I have some specific errors (std.error & std.out) that I'd like to redirect to a log file (ex: pres_err.txt). I'm not familiar with batch programming so I'm not quite sure how to do this.

On the other hand, I kind of know how to do this in Unix but am unsure in a Windows env. For unix, I'd do something like this from the command line:

startServer > somefile 2>&1
meaning: startServer - what ever the command line startup script name you use
> - redirects
somefile - what ever file you want it to go to
2>&1 - redirects both std.error and std.out to the same file

Many thanks in advance.

ps-is there a web resouce for types of DOS .bat commands out here?
 
your command as written above should work in dos. Don't have older version of dos available to test it under, but it worked fine under win2k
 
Don't need to direct the std err and std out.
Only one type of .bat commands. It is a text file that puts the text into the command line buffer just like it was entered from the keyboard. so if you want to know what the commands do use help. such as help fdisk Ed Fair
efair@atlnet.com

Any advice I give is my best judgement based on my interpretation of the facts you supply.

Help increase my knowledge by providing some feedback, good or bad, on any advice I have given.

 
I've managed to get my Integration server running with the following command:
D:\<PACKAGE_ROOT>\bin>./Start Integration_bc int_err.txt 2>&1

this starts up the server OK but I don't think it created the file. i placed an empty int_err.txt file into the dir but nothing has been written to it. that might mean there haven't been any errors though which is probably explained by my next point.

running this:
D:\<PACKAGE_ROOT>\bin>./Start Presentation_bc pres_err.txt 2>&1

gets me this:
Log file created as: D:\<PACKAGE_ROOT\bin\log-20020131115547.txt
java version &quot;1.3.1_01&quot;
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_01)
Java HotSpot(TM) Client VM (build 1.3.1_01, mixed mode)
Usage: java org.apache.tomcat.startup.Tomcat {options}
Options are:
-config file (or -f file) Use this file instead of server.xml
-help (or help) Show this usage report
-home dir (or -h dir) Use this directory as tomcat.home
-stop Shut down currently running Tomcat
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top