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

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

About Nirmal Sharma

Nirmal is a Microsoft MVP in Directory Services and working as a Technical Architect/Consultant. He has been involved in Microsoft Technologies since 1994 and followed the progression of Microsoft Operating Systems and software. He is specialized in Directory Services, Microsoft Clustering, SQL, MOM, Exchange and Citrix. In his spare time, he likes to help others and write "internal" technical articles, white papers and tips on various Microsoft technologies. You can contact him at nirmal_sharma@mvps.org.


Article not looking right or info is missing? Let us know so that we can fix it: .


Receive all the latest articles by email!

Receive Real-Time & Monthly WindowsNetworking.com article updates in your mailbox. Enter your email below!
Click for Real-Time sample & Monthly sample

Become a WindowsNetworking.com member!

Discuss your network issues with thousands of other network administrators. Click here to join!

Community Area

Log in | Register

Readers' Choice

Which is your preferred Anti Spam Hardware solution?

Follow TechGenix on Twitter