Question : Close Open File Handles on Remote Server

I have local admin permissions on the remote servers that I am referring to, but I would like to know how to progmatically or via a command, to be able to remotely close any open files on a remote server. I have a script that copies files to a bunch of servers. users rarely close the open file. I have to manually open Computer Management and find the open file handle and click close file.

It would be nice if I could have a script that looks for files in a directory, checks if they are open, and then closes them.

Or a script where I can place the name of each file and path I want to check on a single line in a text file (so i can update it easily), and then closes the files.

This is very time consuming. Any suggestions?

Answer : Close Open File Handles on Remote Server

Something like this?

FOR /F "usebackq tokens=1 skip=4" %i IN (`net file`) DO net file %i /close

if you use it inside cmd file replace both %i with %%i.

and remember that ` is backquite - this one before 1 key in the topmost row of the keyboard.

And I still would like to warn you before you destroy your user data...
Random Solutions  
 
programming4us programming4us