I am working on a batch script to remap a network drive in windows xp. I have found it to work out well for the most part with:

net use G: /delete
net use G: \\file\share

However, if there are any connections to the drive, it will prompt:

There are open files and/or incomplete directory searches pending on the connection to G:.

Is it Ok to continue disconnecting and force them closed? (Y/N) [N]:

What would be the most graceful way of allowing for this dialog? Is there ever a case where forcing a disconnect would lead to trauma? Is there an alternative method of closing the connections, outside of deleting outright? Kick everything off the drive?


Unless there are actual files still being used on/from the mapped drive (shouldn't be if it's only being mapped to run a script, as long as the disconnect command is at the end) then there shouldn't be any problems forcing a disconnect. On the other hand, if there are files being read to/from the mapped drive, then you should expect some form of data loss.

I specify a force disconnect in my batch files by using:

/delete /y


This happens when files are still in use on the drive. I would strongly recommend closing all files and explorer windows that are open on the share before deleting it.

Forcing a disconnect with open files on the drive is akin to working on a file on the flash drive and then pulling it out while that file is still open. Data corruption galore.

  • This is one of those super paranoid questions, but I am guessing that these are all connections between the local machine and the network drive, and not any other sort of connections. I.E. I am not messing with anyone else by ending my relationship with the drive.
    – MattUebel
    Aug 17 '10 at 13:48
  • @MattUebel - That's right. This will only hurt you, no one else.
    – MDMarra
    Aug 17 '10 at 13:55

This happens when you have no open connections in use on the drive as well. Double check your scripts to see if the connection is ever opened.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.