Once in a while you will come across a file that you can’t move or delete because it is always in use.
A trick to get around this is to have Windows delete or move it on startup – before the system is running and the file is back in use again.
How can you tell Windows to do this?
With a free tool from Microsoft.
It is called MoveFile, and you call it like this from the command line:
movefile c:\temp\source.txt c:\temp\dest.txt
This would move the file source.txt
to dest.txt
on the next reboot
If you wanted to delete the file, simply provide an empty destination:
movefile c:\temp\source.txt ""
Windows will quietly remove it during the next reboot.
Included in the download is a utility called “PendMoves”. This little app will let you know what moves are pending:
Sysinternals - wwww.sysinternals.com
Source: C:\temp\source.txt
Target: C:\temp\dest.txt
Time of last update to pending moves key: 9/1/2011 1:47 AM
Both utilities are free for personal and commercial use, and can be downloaded from here:
http://technet.microsoft.com/en-us/sysinternals/bb897556.aspx
One more thing…Subscribe to my newsletter and get 11 free network administrator tools, plus a 30 page user guide so you can get the most out of them. Click Here to get your free tools
{ 9 comments… read them below or add one }
Thanks for the tip steve. Just used this to help remove a virus. As always, keep it up.
Glad I could help 🙂
Interesting tool. Does this work with Windows 2000?
Sure does. No problems with 2000 through Windows 7 and 2008
A “better” way if you have Professional (XP, Vista, 7) (home edition does not work unless your in safe mode) is to right click on the file and remove the security, remove all users etc system and put disable all. After reboot the file is not allowed to open, but you can delete it. Some programs out there do this, but in my experience not all of the work and the ones that do, don’t work all the time. This method has NEVER failed me. And I remove a lot of viruses and malware from friends, family, etc.
Thanks Dan, that is an excellent tip. I will have to try that next time.
Steve
http://www.emptyloop.com/unlocker/
maybe a nice compare
http://unlocker.en.softonic.com/
Paul
Thanks for the link Paul – Just for anyone else reading this and going to the emptyloop site – It can be difficult to find that download link….lots of links to other adware downloads. Find the actual download by looking for the MD5 and the full version number of the app (Download Unlocker 1.9.1 – 32 bit version MD5: 70cdf58c761ded85d6d15884281974fc)
Just do a search for ‘MD5’ on the page…and it will get you right to the download link. Don’t know how many times I accidentally downloaded that ADL add-on.
Fascinating. I already had this program in my toolkit. I had forgotten what it did. My usual tool for this, dellater, decided that it couldn’t find the file for some reason. 🙁