Windows Commands

Posted on 2011-10-01
Last Modified: 2012-05-12
I am using the following command to disconnect a mapped drive:

net use * /d

Continuing will cancel the connections.

Do you want to continue this operation? (Y/N) [N]:

I am prompted as above:

I want the choice of Y to be applied automatically

I tried the command echo Y|net use * /d

But I am not succeeded.

Need help how to pass Y for the above command so that it should not prompt the user to provide Y or N. Thanks

Question by:jmohan0302
    LVL 59

    Expert Comment

    by:Kevin Cross
    It is probably because you are using *.
    If you can, try:
    NET USE <Drive Letter> /DELETE

    Open in new window

    LVL 76

    Expert Comment

    net use * /delete /Y
    LVL 5

    Expert Comment

    net use * /d does not disconnect a mapped network drive. It disconnects all mapped network drives.
    How much mapped drives do you have?
    net use z: /delete      ---> goes flawless without confirmation question.
    "C:\Users\peer>net use h: /d
    h: was deleted successfully."

    So unless you want to run a script to disconnect all "custom made" connections by users, i would use the disconnection per mapped drive.

    LVL 59

    Expert Comment

    by:Kevin Cross
    If you do indeed want to do all mapped drives, do like this:
    NET USE * /D /Y

    Open in new window

    LVL 59

    Expert Comment

    by:Kevin Cross
    Argh. I should have refresh, fellas, sorry. That was the point of my first post. The prompt for confirmation is due to doing ALL mapped drives. Doing one at a time works without prompt as also confirmed by peter197911. That was my point in first post if it was not clear. As shown by arnold, if you do want to do all drives it is /Y at the end. Not Y|.
    LVL 66

    Accepted Solution

    Easy way to kill them all is

    reg delete "hkcu\network" /f

    Often gets the stubborn ones that wont delete with a net use command.....

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    This is a little timesaver I have been using for setting up Microsoft Small Business Server (SBS) in the simplest possible way. It may not be appropriate for every customer. However, when you get a situation where the person who owns the server is i…
    When you upgrade from Windows 8 to 8.1 or to Windows 10 or if you are like me you are on the Insider Program you may find yourself with many 450MB recovery partitions.  With a traditional disk that may not be a problem but with relatively smaller SS…
    This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
    In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …

    728 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

    15 Experts available now in Live!

    Get 1:1 Help Now