Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

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

share|improve this answer

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.

share|improve this answer
    
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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