Solved

Windows XP - DOS command - net use /delete how to force deletion even if files are in use

Posted on 2008-10-14
5
40,827 Views
Last Modified: 2012-06-21
At the command prompt (Windows XP system), if I type in the command:

net use x: /delete /y

it will delete the drive mapping, but only if not in use.

is there a way to force the deletion *even if files are in use*??
(i know this can lead to other issues, but there is a specific reason why we need to do this).

thanks in advance.

0
Comment
Question by:sah18
5 Comments
 
LVL 4

Expert Comment

by:Chris James
Comment Utility
0
 
LVL 95

Expert Comment

by:Lee W, MVP
Comment Utility
dj_ludachris.

You should know by now, you're not new here - posting of links alone is not appropriate without some kind of explanation... and your link alone is a help file for NET USE without addressing the actual question, as near as I can tell.

sah18,

You can use the openfiles command to close any existing open files and then use the net use command to disconnect the drive.
0
 
LVL 1

Expert Comment

by:nixgibs
Comment Utility
you  can do this with VB script

the parameter bForce will remove the drive even if it is in use
Dim WshNetwork

on error resume next

Set WshNetwork = WScript.CreateObject("WScript.Network")

WshNetwork.RemoveNetworkDrive ("T:", bForce)

Open in new window

0
 
LVL 4

Accepted Solution

by:
Chris James earned 500 total points
Comment Utility
To expand on leew's answer:

try:    openfiles /disconnect /id *

and then use your net use command to disconnect the drive.


0
 

Expert Comment

by:jvick69
Comment Utility
I know this is an old problem, but another way I just found is to change directories back to c: before your net use delete.
0

Featured Post

Too many email signature updates to deal with?

Do you feel like you are taking up all of your time constantly visiting users’ desks to make changes to email signatures? Wish you could manage all signatures from one central location, easily design them and deploy them quickly to users? Well, there is an easy way!

Join & Write a Comment

Several part series to implement Internet Explorer 11 Enterprise Mode
This is an article about Leadership and accepting and adapting to new challenges. It focuses mostly on upgrading to Windows 10.
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…

762 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

10 Experts available now in Live!

Get 1:1 Help Now