How To Forcefully Close A File On Remote Computer Using Command Line?

There are many ways to close an open file forcefully on a remote computer. For example, you can use Compmgmt.msc (Shared Folder snap-in) > Connect to the remote computer and then close the open files. There are two other methods you can use to close the open files which are explained in this article:You can use either Net File or PSFile (Microsoft utility) to close the files. The first command requires you to run the NET File command using the Psexec.exe remotely. The NET command doesn't support Remote APIs.

  • To close an open file on a remote computer using the Net File command:

Psexec.exe \\remote_computer_name NET FILE {ID_of_the file OR the file name} /close

  • To close an open file on a remote computer using the PSFile command:

PSFile.exe \\remote_computer_name {ID_of_the_file OR FIle_Path} -c

The -C directs PSFile to close the file. For more information on PSFile, visit the Microsoft Web site at:

About The Author

Leave a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Scroll to Top