how do I hide a output of a net use /delete
I have a login script that deletes drive mappings. If the drives are do not
exist I see a error message. How do I hide the messages?
I have tried piping output to nul or a file but I still see the error
message. What am I missing
c:\net use i: /delete>NUL
Example
C:\net use i: /delete
The network connection could not be found.
More help is available by typing NET HELPMSG 2250.
or
C:\net use i: /delete>NUL
The network connection could not be found.
More help is available by typing NET HELPMSG 2250.
Re: how do I hide a output of a net use /delete
AdminKen wrote:
> I have a login script that deletes drive mappings. If the drives are do not
> exist I see a error message. How do I hide the messages?
>
> I have tried piping output to nul or a file but I still see the error
> message. What am I missing
>
> c:\net use i: /delete>NUL
>
> Example
> C:\net use i: /delete
> The network connection could not be found.
> More help is available by typing NET HELPMSG 2250.
>
> or
> C:\net use i: /delete>NUL
> The network connection could not be found.
> More help is available by typing NET HELPMSG 2250.
>
The short answer is use "2>NUL", like this:
C:\>net.exe use i: /delete >NUL 2>NUL
Most programs send their output to the stdout stream, which is
represented by handle 1, or assumed if not present. So what you were
doing is the same as this:
C:\>net.exe use i: /delete 1>NUL
Some programs separate their output, they send informational messages to
stdout, and errors to stderr, represented by handle 2.
You could also stderr (handle 2) to the same place as stdout (handle 1),
like this:
C:\>net.exe use i: /delete 1>NUL 2>&1
For more information click Start -> Help and Support, and search for
"using command redirection operators"
RE: how do I hide a output of a net use /delete
Try this:
net use i: /delete 2>NUL >NUL
that should redirect both stdout & stderr
~Jeremy
"AdminKen" wrote:
> I have a login script that deletes drive mappings. If the drives are do not
> exist I see a error message. How do I hide the messages?
>
> I have tried piping output to nul or a file but I still see the error
> message. What am I missing
>
> c:\net use i: /delete>NUL
>
> Example
> C:\net use i: /delete
> The network connection could not be found.
> More help is available by typing NET HELPMSG 2250.
>
> or
> C:\net use i: /delete>NUL
> The network connection could not be found.
> More help is available by typing NET HELPMSG 2250.
>
>
>
Re: how do I hide a output of a net use /delete
that worked
thanks
"J Ford" <JFord@discussions.microsoft.com> wrote in message
news:4FF4DBB1-B3C6-438E-910E-1FD411E977B0@microsoft.com...
> Try this:
>
> net use i: /delete 2>NUL >NUL
>
> that should redirect both stdout & stderr
>
> ~Jeremy
>
> "AdminKen" wrote:
>
>> I have a login script that deletes drive mappings. If the drives are do
>> not
>> exist I see a error message. How do I hide the messages?
>>
>> I have tried piping output to nul or a file but I still see the error
>> message. What am I missing
>>
>> c:\net use i: /delete>NUL
>>
>> Example
>> C:\net use i: /delete
>> The network connection could not be found.
>> More help is available by typing NET HELPMSG 2250.
>>
>> or
>> C:\net use i: /delete>NUL
>> The network connection could not be found.
>> More help is available by typing NET HELPMSG 2250.
>>
>>
>>