Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

>NUL In a batch file does not hide every output

728 views
Skip to first unread message

Paul

unread,
Apr 29, 2003, 2:20:38 PM4/29/03
to
Hi,

At my work we use an NT4 domain with login scripts for every user.
They look somthing like:

net use g: \\server\share1
net use h: \\server\share2

We wanted to hide the output...
For example "The command completed successfully"

So we added:

net use g: \\server\share1 >nul
net use h: \\server\share2 >nul

This works fine as far as the "The command completed successfully"
message goes. The problem is once the user has logged in once they get
a message saying:

"System error 85 has occurred.

The local device name is already in use."

I want to use the net use ... >nul command but I want NO OUTPUT AT
ALL. Even if the drive failes to map for some reason. I know all about
the net use /p:no option but I want something like >nul but that does
not display anything to the screen. Hope you know what I mean.

Thanks for your time

Paul

William Allen

unread,
Apr 29, 2003, 2:24:42 PM4/29/03
to
"Paul" wrote in message

> Hi,
>
> At my work we use an NT4 domain with login scripts for every user.
> They look somthing like:
>
> net use g: \\server\share1
> net use h: \\server\share2
>
> We wanted to hide the output...
> For example "The command completed successfully"
>
> So we added:
>
> net use g: \\server\share1 >nul
> net use h: \\server\share2 >nul
>
> This works fine as far as the "The command completed successfully"
> message goes. The problem is once the user has logged in once they get
> a message saying:
>
> "System error 85 has occurred.
...snip

Have you tried redirecting both STDERR (channel 2) and STDIN
(channel 1) to NUL? Typical syntax for example DIR command:

DIR ::nofile >NUL 2>&1

--
William and Linda Allen
Creative Technical Writing - Allen & Company: http://www.allenware.com/
Free MS-DOS Batch File Course http://www.allenware.com/find?BatchCourse


William Allen

unread,
Apr 29, 2003, 2:26:10 PM4/29/03
to
"Paul" wrote in message

> Hi,
>
> At my work we use an NT4 domain with login scripts for every user.
> They look somthing like:
>
> net use g: \\server\share1
> net use h: \\server\share2
>
> We wanted to hide the output...
> For example "The command completed successfully"
>
> So we added:
>
> net use g: \\server\share1 >nul
> net use h: \\server\share2 >nul
>
> This works fine as far as the "The command completed successfully"
> message goes. The problem is once the user has logged in once they get
> a message saying:
>
> "System error 85 has occurred.
...snip

Have you tried redirecting both STDERR (channel 2) and STDOUT

Marty List

unread,
Apr 29, 2003, 2:31:15 PM4/29/03
to

There is a "standard out" and also a "standrard error", both of them need to
be redirected to NUL. stdout is 1, or the default if you don't specify a
number. So "net use g: \\server\share1 >nul" is really the same thing as
"net use g: \\server\share1 1>nul".

What you want to hide is stderr, or #2, so try this:

net use g: \\server\share1 >nul 2>nul

Or to get the same effect you can redirect 2 to the same place as 1, which
would look like this:

net use g: \\server\share1 >nul 2>&1

Of course all these hide any real error messages, like 53 if the server is
not available or 5 for access is denied.

"Paul" <thef...@aol.com> wrote in message
news:a17835b8.03042...@posting.google.com...

Mike Mohr

unread,
May 1, 2003, 10:04:45 PM5/1/03
to
"Marty List" <Bill....@sun.com> wrote in message
news:b8mgdk$bi6gs$1...@ID-172409.news.dfncis.de...

>
> There is a "standard out" and also a "standrard error", both of them need
to
> be redirected to NUL. stdout is 1, or the default if you don't specify a
> number. So "net use g: \\server\share1 >nul" is really the same thing as
> "net use g: \\server\share1 1>nul".
>
> What you want to hide is stderr, or #2, so try this:
>
> net use g: \\server\share1 >nul 2>nul
>
> Or to get the same effect you can redirect 2 to the same place as 1, which
> would look like this:
>
> net use g: \\server\share1 >nul 2>&1
>
> Of course all these hide any real error messages, like 53 if the server is
> not available or 5 for access is denied.

The simple solution would be to direct the STDERR to a file.


Paul

unread,
May 3, 2003, 7:01:43 PM5/3/03
to
Thanks all,

Just what I needed.

Paul

0 new messages