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.

Thanks,

Tony
tnormanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.
0
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.

TN
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tnormanAuthor Commented:
Solution provided didn't specifically address the issue. Found own solution shortly after posting question.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Server 2008

From novice to tech pro — start learning today.