Solved

cmd line command to kill open files on a server?

Posted on 2004-09-22
5
560 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Occasionally Windows/Microsoft Updates will fail to update. We have found a code that will delete all temporary files and re-register all dll's related to Windows/Microsoft Updates! This works 99% of the time to get the updates working again! The…
Windows 10 is here and for most admins this means frustration and challenges getting that first working Windows 10 image. As in my previous sysprep articles, I've put together a simple help guide to get you through this process. The aim is to achiev…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

757 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

23 Experts available now in Live!

Get 1:1 Help Now