Forcing MAP drive to be deleted. URGENT

I'm running a map drive disconnection using dos command:
NET USE z: /delete

and sometimes it says:
There are open files and/or incomplete directory searches pending on connection to z:
Is it ok to continue disconnectind and force them closed? Y:N

How can I force that automaticley to Y, and not having that message to prompt me for Y or N?


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Not sure about your method, but I use this method to delete mappings and have had no issues:
@echo off
If %OS% == Windows_NT GOTO WINNT
Echo The batch did not detect Windows NT, using Win9x

net use q: \\server\sharename /persistent:no

net use q: \\server\sharename


Above is a copy of a login script i use. This script checks the OS & runs the appropriate net use command. The key point here is for Windows 2000 & above is the /persistent:no switch. This stops these OS's from 'keeping' the mapped share. I don't know how u map drives at your  location but i use login scripts. I don't allow users to map drives themselves. By using scripts u can change mapping without having to 'visit' each PC. Let me know
jdffAuthor Commented:
I'm using the same script method but I first delete the map and then recreat them but the problem seams to happen on the deletion. It ask me to force the deletion.

If u r using the '/persistent:no' switch for Win2K & XP PC's then u dont need to delete first. Try removing the 'delete' piece, as u really don't need it.
net use z: /delete /yes
will do the trick.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows XP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.