Avatar of jmohan0302
jmohan0302

asked on 

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

Microsoft Legacy OS

Avatar of undefined
Last Comment
johnb6767
Avatar of Kevin Cross
Kevin Cross
Flag of United States of America image

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

Open in new window

Avatar of arnold
arnold
Flag of United States of America image

net use * /delete /Y
Avatar of peter197911
peter197911
Flag of Netherlands image

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.

Avatar of Kevin Cross
Kevin Cross
Flag of United States of America image

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

Open in new window

Avatar of Kevin Cross
Kevin Cross
Flag of United States of America image

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|.
ASKER CERTIFIED SOLUTION
Avatar of johnb6767
johnb6767
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Microsoft Legacy OS
Microsoft Legacy OS

The Microsoft Legacy Operating System topic includes legacy versions of Microsoft operating systems prior to Windows 2000: All versions of MS-DOS and other versions developed for specific manufacturers and Windows 3/3.1, Windows 95 and Windows 98, plus any other Windows-related versions, and Windows Mobile.

55K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo