Solved

cmd line command to kill open files on a server?

Posted on 2004-09-22
5
565 Views
Last Modified: 2008-01-16
Is there some command line command to kill all connections to an open file on a server?

myfootsmells
0
Comment
Question by:myfootsmells
  • 3
5 Comments
 
LVL 95

Expert Comment

by:Lee W, MVP
ID: 12124948
Well:
net stop server
will stop the server serrvice and cut off everyone connected.

A quick way to do this is to type the following on a command line:

net stop server & net start server

The above line will both stop and then restart the server service in as quick a time as possible.

You do realize, you'll end up potentially screwing up peoples files if you close open connections...
0
 
LVL 5

Author Comment

by:myfootsmells
ID: 12125188
There isn't a way for me to close a specific file?

Yes I understand that, but there are certain files that need to be altered at midnight and if users have that file open, well it doesnt work :)

myfootsmells
0
 
LVL 95

Expert Comment

by:Lee W, MVP
ID: 12125316
0
 
LVL 95

Accepted Solution

by:
Lee W, MVP earned 50 total points
ID: 12125335
And lastly, this may be exactly what you are looking for:

for /f "usebackq tokens=1" %a in (`net file ^| find /i "OpenFileName"`) do @net file %a /close

Note: if using this in a batch file, replace all %a with %%a - the above entry is meant only for running directly from a command line.
0
 
LVL 5

Expert Comment

by:sai2480
ID: 12131778
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

Title # Comments Views Activity
PERL - Find newest folder 12 151
NTP Server in VMware 5 295
Event-ID 3001, 3011 - LoadPerf - Windows Server 2003 14 63
Windows 8.1 HP issues 11 44
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
#Citrix #POC #XenDesktop #vCenter #VMware #ESX
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

830 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