Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2008-10-14
5
Medium Priority
?
41,032 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 96

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 2000 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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

Windows Server 2003 introduced persistent Volume Shadow Copies and made 2003 a must-do upgrade.  Since then, it's been a must-implement feature for all servers doing any kind of file sharing.
By default Outlook 2016 displays only one time zone in the Calendar. The following article explains how to display two time zones in one calendar view.
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

609 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