Link to home
Start Free TrialLog in
Avatar of Bob Stamm
Bob StammFlag for United States of America

asked on

Batch Programming turn off messages

I am writing a batch file routine.  I need to create a file structure and I am using the md command to accomplish this.

md c:\NetworkDsgn\CoaxMaps\DWF\OH

My Question is the second time I run this application I get the following message.  

A subdirectory or file c:\NetworkDsgn\CoaxMaps\DWF\OH already exists.

Is there a way to turn this message off?  The application runs fine it is just a nuisance message that I would like to not show.  PS. I need to show other messages and I am using the ECHO command to do so.

Thanks,
Bob


SOLUTION
Avatar of Harisha M G
Harisha M G
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mgalig1010
mgalig1010

Hi RobertStamm,
Try
 md c:\NetworkDsgn\CoaxMaps\DWF\OH > Null


Regards,
Marcos
RobertStamm and mgalig1010, to redirect error message, you should use 2>
Under XP you can't redirect errors by re-routing output to NULL so I use an if statement:

@echo off

IF exist C:\temp goto END

md \temp

:END


Avatar of Bob Stamm

ASKER

mgh mqharish,
Thank you.  just what I needed.
Bob
>> Under XP you can't redirect errors by re-routing output to NULL

Really ? Test NUL instead of NULL :)

Thanks Bob.
>> Under XP you can't redirect errors by re-routing output to NULL

Wrong.

   md c:\NetworkDsgn\CoaxMaps\DWF\OH >Nul 2>&1

'>Nul 2>&1' will diminish even output to the error stream.
IM, what's &1 ?
Seen.
-->It redirects file handle 2 to file handle 1.  File handle 1 was redirected to
-->nul (> nul), so it is also redirecting file handle 2 (stderr) to nul.
-->This is the syntax to use if you want no normal output and no error output for
-->a console application.


Huh, learned something new.  So... your first answer was incomplete :)

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Akin -

md c:\temp >null 2>null

Should work

Since the 1>&1 is actually refering to the first redirect of >nul

Damn cool.
LOL Rob_Jeffrey, he just wanted to remove error messages, not the normal messages ;)
That wouldn't work until you use NUL instead of NULL

Notice single L
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Redistributeing the points due to the additional diccussion following the orginal assigning of points.
Thanks everyone for your input in soulving this issue!
Bob
Thank you - but it wasn't necessary.
Appreciated.
Rob_Jeffrey, thanks :)
:))

RobertStamm, thanks for you