Jump to content

Q: Failsafe 'net Use /delete' Command?


Recommended Posts

Guest phkappler
Posted

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

Guest phkappler
Posted

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

Posted

/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:

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...