[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

send result to a txt based log file

Posted on 2011-10-10
4
Medium Priority
?
199 Views
Last Modified: 2012-05-12
Dear all expertise,

Right now I want to create a .bat file and execute it while export the result to a txt file, how can I do the export of result to a txt file ?

DBA100.
0
Comment
Question by:marrowyung
  • 3
4 Comments
 
LVL 6

Expert Comment

by:Gerald26
ID: 36942920
Try to launch your Batch fril fomr command line, add this syntax:

Mybatfile.bat 2>c:\temp\ERROR.TXT >c:\TEMP\LOG.txt
0
 
LVL 6

Expert Comment

by:Gerald26
ID: 36942929
oh my god, I typed too fast !
I meant "Try to launch your Batch file from a command line" of course.

This syntax will redirect error canal(2) in error.txt file and output canal (1) in Log.txt file.
0
 
LVL 10

Accepted Solution

by:
Alan_White earned 500 total points
ID: 36943125
As an additon to Gerald26's postings, it is possible to redirect any errors to the same file as the main output (stdErr and stdOut).

mybatfile.bat > c:\temp\log.txt 2>&1

The 2>&1 tells it to put the errors into the first log file.
0
 
LVL 6

Assisted Solution

by:Gerald26
Gerald26 earned 500 total points
ID: 36943141
And finally you can use

Mybatfile.bat >> C:\temp\log.txt 2>&1 to add new content to old log file each time you start your batch program without erasing previous output.



0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article shows how to use a free utility called 'Parkdale' to easily test the performance and benchmark any Hard Drive(s) installed in your computer. We also look at RAM Disks and their speed comparisons.
By default Outlook 2016 displays only one time zone in the Calendar. The following article explains how to display two time zones in one calendar view.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

834 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