Sign in to follow this  
Followers 0
Gloubs

"net use" returncode

5 posts in this topic

Hi all !

I'm making a script to disconect a mapped network drive.

the main action is done by a "net use" command like this :

$ret1 = runwait(@comspec & " /c net use " & $drive & ": /delete /no")

I'd like to check if the command ran well, so I'd like to know about the return codes of the net use command...

Anyone has a tip ?

Thanks !!

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I dont know much about net use, but I bet a quick google would tell you what you need to know.

Edit: After googling myself I think the only way to figure out if it has been properly deleted is to check and see if the exists. I dont know how to do that but I hope it has been helpful to push you in that direction.

JS

Edited by JSThePatriot

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

Just use DriveMapDel in the unstable.


Who else would I be?

Share this post


Link to post
Share on other sites

If you really wnat to use net use /delete, you could add the following to check.

$var = DriveStatus($drive)
MsgBox(4096,"Status",$var)

You could also try a few scenarios and get the value of $rte1

I have tried 2 things,

1: run the script when a drive is not mapped, $rte1 value = 2

2: run the script when drive is mapped, delete successful $ret1 value = 0

Hope it helps


CheersNobby

Share this post


Link to post
Share on other sites

Thanks nobby you took my suggestion and put some code behind it. I didnt know what code to use, so I didnt bother looking it up as I dont see the need I may have for that :)

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0