• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 200
  • Last Modified:

Windows Commands

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

1 Solution
Kevin CrossChief Technology OfficerCommented:
It is probably because you are using *.
If you can, try:
NET USE <Drive Letter> /DELETE

Open in new window

net use * /delete /Y
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.

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Kevin CrossChief Technology OfficerCommented:
If you do indeed want to do all mapped drives, do like this:

Open in new window

Kevin CrossChief Technology OfficerCommented:
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|.
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now