Bob Stamm
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\DW F\OH
My Question is the second time I run this application I get the following message.
A subdirectory or file c:\NetworkDsgn\CoaxMaps\DW F\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
md c:\NetworkDsgn\CoaxMaps\DW
My Question is the second time I run this application I get the following message.
A subdirectory or file c:\NetworkDsgn\CoaxMaps\DW
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
@echo off
IF exist C:\temp goto END
md \temp
:END
ASKER
mgh mqharish,
Thank you. just what I needed.
Bob
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.
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\DW F\OH >Nul 2>&1
'>Nul 2>&1' will diminish even output to the error stream.
Wrong.
md c:\NetworkDsgn\CoaxMaps\DW
'>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 :)
-->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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Akin -
md c:\temp >null 2>null
Should work
Since the 1>&1 is actually refering to the first redirect of >nul
Damn cool.
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
Notice single L
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Redistributeing the points due to the additional diccussion following the orginal assigning of points.
Thanks everyone for your input in soulving this issue!
Bob
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
RobertStamm, thanks for you
Try
md c:\NetworkDsgn\CoaxMaps\DW
Regards,
Marcos