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

EXIT CODES FOR NET.EXE

1,746 views
Skip to first unread message

v

unread,
Aug 21, 2002, 11:20:07 PM8/21/02
to
Does anyone know the exit codes for NET USE?
Does this mean that there is a code below zero?

=========( CODE )========
ECHO CONNECT TO USER
NET USE %DRIVE% "\\%NAME%\C" /YES
IF ERRORLEVEL 1 GOTO CONNECT
IF ERRORLEVEL 0 GOTO EXIT

:CONNECT
XCOPY *.* /S D:\%USERNAME%

:EXIT
ECHO DID NOT CONNECT
========================

+++++++( SCREEN )+++++++++
CONNECT TO USER
The command was completed successfully.
DID NOT CONNECT
+++++++++++++++++++++++++


Glenn W. Betz, III

unread,
Aug 22, 2002, 10:14:45 AM8/22/02
to
No. It means that you are missing a label and a goto.
The code should be as follows.
======================================

ECHO CONNECT TO USER
NET USE %DRIVE% \\%NAME%\C /YES
IF ERRORLEVEL 1 GOTO CONNECT
IF ERRORLEVEL 0 GOTO EXIT

:CONNECT
XCOPY *.* /S D:\%USERNAME%

GOTO :EOF

:EXIT
ECHO DID NOT CONNECT

GOTO :EOF

:EOF
======================================
Glenn W. Betz, III

"v" <supe...@wattyl.co.nz> wrote in message
news:TKY89.910$Fc4.1...@news.xtra.co.nz...

v

unread,
Aug 22, 2002, 7:34:50 PM8/22/02
to
Thanks to William Allen and Todd Vargo for there code in finding
ERRORLEVEL's.
NET USE does not return any error codes.
I have changed the design to check for the existance of the drive.

=========( Code )===========


NET USE %DRIVE% "\\%NAME%\C" /YES

IF EXIST %DRIVE%\NUL ECHO %DRIVE% EXISTS
IF NOT EXIST %DRIVE%\NUL ECHO %DRIVE% DRIVE DOES NOT EXIST
==============================

Regards

VERNON


N en O in@wsanpadaoom.fr Thierry

unread,
Aug 23, 2002, 7:16:00 AM8/23/02
to
v <supe...@wattyl.co.nz> a écrit dans le message :
TKY89.910$Fc4.1...@news.xtra.co.nz...

> Does anyone know the exit codes for NET USE?
> Does this mean that there is a code below zero?

Hi,

I don't know them... but you can test a specific file that should be found
on the mapped drive
................................
Net use x: /d
Net use x: \\server\share
If exist x:\flagfile.txt goto ConnectionOK
echo ConnectionFailed
goto End

:ConnectionOK
Echo ConnectionIsOK

:End
......................


0 new messages