473,322 Members | 1,736 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Why DOS output of DEL commands to a file won't display error messages?

2
Hi. Yes DOS still lives.... I am directing multiple delete (DEL) commands to an output file e.g.
del /F /Q D:\Oracle\CoreMid\Apache\Apache\logs\*.* >vh.txt
del /F /Q D:\Oracle\Core\Apache\Apache\logs\*.* >>vh.txt
del /F /Q D:\Oracle\CoreMid\opmn\logs\*.* >>vh.txt
del /F /Q D:\Oracle\CoreMid\webcache\logs\*.* >>vh.txt
del /F /Q D:\Oracle\CoreInfra\opmn\logs\*.* >>vh.txt

I am appending the output in each case except line 1 - that part is ok.
However when there is an error message it doesnt appear in the output file. For example if I run this command (del /F /Q D:\Oracle\CoreMid\opmn\logs\*.*) at Dos prompt I get:
D:\Oracle\CoreMid\opmn\logs\HTTP_Server~1
The process cannot access the file because it is being used by another process.
D:\Oracle\CoreMid\opmn\logs\ipm.log
The process cannot access the file because it is being used by another process.
D:\Oracle\CoreMid\opmn\logs\OC4J~home~default_isla nd~1
The process cannot access the file because it is being used by another process.

However if I run it with output to file vh.txt i get:
D:\Oracle\CoreMid\opmn\logs\HTTP_Server~1
D:\Oracle\CoreMid\opmn\logs\ipm.log
D:\Oracle\CoreMid\opmn\logs\OC4J~home~default_isla nd~1

As you can see there are no error message in the output results that are written to file, but they are displayed if output is to screen.
How can I capture the error messages in the output file???
Jan 12 '11 #1
3 6553
Banfa
9,065 Expert Mod 8TB
The error messages are pipe to stderr however >vh.txt redirects stdout to vh.txt so the file only contains messages sent to stdout and messages sent to stderr are not present.

You need to redirect messages to stderr to stdout and messages to stdout to your file. You can redirect messages to stderr to stdout using the syntax "2>&1" (pipe stream 2 to stream 1) so you whole command should be

del /F /Q D:\Oracle\CoreMid\Apache\Apache\logs\*.* >vh.txt 2>&1
Jan 13 '11 #2
vhogan
2
Thanks Banfa, that was very helpful and what's more it worked first time!!!

Thanks again.

V
Jan 13 '11 #3
NeoPa
32,556 Expert Mod 16PB
There are three standard files associated with DOS (from Unix) programs :-
stdin
stout
stderr

Correctly written programs or filters will always send their error messages to stderr to avoid any potential of corrupting stdout (which may, of course, be used by another process as its stdin and is often parsed in a particular way - that doesn't include handling error text)

I must admit though (I haven't used any of it for a while mind) that I wasn't aware that stout could be reassigned from a DOS command line (although I have a vague recollection that I've always known it could be done in Unix). Nice one Banfa. I learned something today.
Jan 17 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: John Alleyman | last post by:
Hi there, Is there a simple way to prevent error messages (falsely connecting to database etc.) being diplayed? My own build in messages are enough... thanks, Chris
10
by: r6uji7 | last post by:
hello, i am new to PHP programming and wondered if u could help. lets say i have the following files: 1. error.php: that is routed to for all errors. this page should display proper and...
1
by: Kenneth McDonald | last post by:
I'm setting myself up to use Python with jEdit (after trying jed, VIM, others...urggh.) One small problem I'm having is that while jEdit has a nice plugin called Console which can be set up to run...
4
by: seamus | last post by:
I transferred a new web that worked last week to my production server. Now none of my asp pages will display. Any suggestions?
2
by: Stuart Palmer | last post by:
I have a little gripe with my ASP pages, for some reason I am not getting error messages I would expect and don't know if it's an ASP thing, browser thing or IIS problem. I use option explicit...
3
by: Shabam | last post by:
I know that dotnet allows for form field validation. However I'm looking to customize the error message display and am wondering if it's possible to do what I need. Example: Suppose in a...
1
by: johnpeter887 | last post by:
On windows xp we can modify 500-100.asp file for custom asp error messages. How can we do this on a windows NT 4.0 and IIS. or what is the similar file on NT and IIS?
0
by: Burkhard Schultheis | last post by:
I updated some of our machines with new packages. All machines run DB2 V7.2.8. On one machine only I saw this output from bind: db2 bind lzg_alar.bnd blocking no isolation ur LINE MESSAGES FOR...
1
by: intl04 | last post by:
I am getting strange print-related error messages when trying to create (not print!) reports. For example, when I click 'new' to create a report then choose 'design view', I get an error message...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.