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,922 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 4

Expert Comment

by:Chris James
ID: 22714499
0
 
LVL 95

Expert Comment

by:Lee W, MVP
ID: 22714646
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
ID: 22714666
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
ID: 22715006
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:Joe Vick
ID: 35857572
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
In this article, I will show you HOW TO: Perform a Physical to Virtual (P2V) Conversion the easy way from a computer backup (image).
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…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

740 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