Sign in to follow this  
Followers 0
Guest phkappler

Q: Failsafe 'net Use /delete' Command?

3 posts in this topic

I do map some shares to drive letters within an AutoIt script utilizing the 'net use' command. This works flawless. However, I'm experiencing difficulties when trying to delete those mappings. In some cases, I get an error message that there are open files:

X:\>net use p: /delete
Entweder sind Dateien geöffnet, oder die Suche in den Verzeichnissen auf p:
ist noch nicht abgeschlossen.

Soll die Verbindung getrennt werden? (J/N) [N]:

This message would need "j{ENTER}" to close. However, I can't do any error handling because the script waits for the RunWait command to terminate. To use Run isn't a way either because the mapping is timing-critical and the number of seconds needed varies depending on the single PC and its position in our network.

Is there any fail-safe 'net use /delete'-like command? Has anyone written a piece of code already? Any hints?

Thanks for your time and your ideas.

Best regards,

Philipp

Share this post


Link to post
Share on other sites



I succeeded at last. A simple (while undocumented) /Y did the trick.

Share this post


Link to post
Share on other sites

/y do the trick in this case, but if you have the same problem with programs that do not have that possibility you can always try

echo s|(command)

Like

echo s|format c: /u :whistle:

Share this post


Link to post
Share on other sites
Sign in to follow this  
Followers 0