?
Solved

cmd line command to kill open files on a server?

Posted on 2004-09-22
5
Medium Priority
?
575 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
[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
  • 3
5 Comments
 
LVL 96

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 96

Expert Comment

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

Accepted Solution

by:
Lee W, MVP earned 200 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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Many people tend to confuse the function of a virus with the one of adware, this misunderstanding of the basic of what each software is and how it operates causes users and organizations to take the wrong security measures that would protect them ag…
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…
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.

752 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