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

by Nirmal Sharma [Published on 24 Aug. 2008 / Last Updated on 27 Nov. 2008]

This article explains the steps you can use to close a file forcefully on a remote computer.

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:

http://www.microsoft.com/technet/sysinternals/Networking/PsFile.mspx

Featured Links