• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 494
  • Last Modified:

Close an open file on a server 2008 server

(Before I describe the issue, I want to stress that I am just looking for an answer to this particular question. The background and situation description would take 2000 words.)

Is there a way, either through a utility or a command line, to close an open file?

You can use the 'net file' command to close and open file, but that requires that you know the file ID#. However, each time a particular (same) file is opened, it gets a new ID#.

I need a way to close a particular file on demand through the command line or through a scheduled task.


  • 2
1 Solution
Tony GiangrecoCommented:
There are probably more ways to do this, but from a command line or task scheduler, you could probably execute a cmd or batch file with a command like this:

TASKKILL /F /IM notepad.exe

I'd put it in notepad, save it as stopapp.cmd and then schedule it in task scheduler.
tnormanAuthor Commented:
Thanks for that suggestion, TG-TIS. However, that would involve killing the program running that has the file open, which isn't what I was looking for.

I found a program called 'Unlocker' which did exactly what I needed.

Thanks again for your time.

tnormanAuthor Commented:
Solution provided didn't specifically address the issue. Found own solution shortly after posting question.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now