Close files opened by another app

S

ssg31415926

I've just had a colleague ask me this one: is it possible to close
files opened (and left open) by another app, programatically? I know
it must be possible because NET FILE can do it as can Computer
Management.

I can't find an obvious place to start in .NET - is there one? I came
to .NET via scripting and haven't ever done Win32 stuff. Can anyone
point me towards a place to start?

Cheers

SSG
 
G

Guest

If NET FILE will do what you want, then you can just call that on the command
line from your app via Process.Start.
Peter
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

I dont think this is possible. at least with managed code.

Of course if you find a method to force win to release the handle of that
file then the file will be considered "closed" and you can open it. Not sure
how to do this (even if possible) though.
 
S

ssg31415926

Thanks. Yes, I could do that but it's not very nice! I was hoping for
something a bit more elegant! Yes, I know, if it works...

SSG
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top