Forcing MAP drive to be deleted. URGENT

Posted on 2004-12-01
Last Modified: 2008-02-26
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?


Question by:jdff
    LVL 18

    Expert Comment

    Not sure about your method, but I use this method to delete mappings and have had no issues:
    LVL 1

    Expert Comment

    @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

    Author Comment

    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.

    LVL 1

    Assisted Solution

    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.
    LVL 82

    Accepted Solution

    net use z: /delete /yes
    will do the trick.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Suggested Solutions

    There are 2 things you must have in order to connect to the internet behind a router, The "Gateway IP" of the router, which is usually something like, I've seen routers with default values of:,,, …
    If you have done a reformat of your hard drive and proceeded to do a successful Windows XP installation, you may notice that a choice between two operating systems when you start up the machine. Here is how to get rid of this: Click Start Clic…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now