Loading...
 
JoiWiki » Developer » Using Windows » Windows Scripting » Windows Script Snippets » Delete Locked File in Windows with Powershell Delete Locked File in Windows with Powershell

Delete Locked File in Windows with Powershell

Delete a Locked File in Windows

 We've all tried to delete a file only to be told that it's locked by some process or other and yes, it's definitely possible to try and close down all of the applications you've got open and hope that that does the job but if you're anything like me you're doing 3 things at once and each of those things involve multiple applications, reference materials, notepad sccribblings and chrome tabs so avoiding that is always a nice thing.

 

Powershell

 This solution makes use of Powershell which, as Microsoft would say, is a task-based command-line shell and scripting language built on .NET. As you generally expect from a command line interface you can call it from any location in windows explorer by holding shift and right clicking.

 

So the very simple command that you need is:

remove-item textFile.txt

 

Simple eh?

 

Created by JBaker. Last Modification: Thursday February 21, 2019 21:18:22 GMT by JBaker.

Developer