CertCities.com -- The Ultimate Site for Certified IT Professionals
Listen, See, Win! Register for a Free Tech Library Webcast Share share | bookmark | e-mail
  Microsoft®
  Cisco®
  Security
  Oracle®
  A+/Network+"
  Linux/Unix
  More Certs
  Newsletters
  Salary Surveys
  Forums
  News
  Exam Reviews
  Tips
  Columns
  Features
  PopQuiz
  RSS Feeds
  Press Releases
  Contributors
  About Us
  Search
 

Advanced Search
  Free Newsletter
  Sign-up for the #1 Weekly IT
Certification News
and Advice.
Subscribe to CertCities.com Free Weekly E-mail Newsletter
CertCities.com

See What's New on
Redmondmag.com!

Cover Story: IE8: Behind the 8 Ball

Tech-Ed: Let's (Third) Party!

A Secure Leap into the Cloud

Windows Mobile's New Moves

SQL Speed Secrets


CertCities.com
Let us know what you
think! E-mail us at:



 
 
...Home ... Editorial ... Columns ..Column Story Saturday: April 5, 2014


 Tip o'the Week  
Zubair Alexander
Zubair Alexander


 Moving, Deleting a File That's Always in Use
I need to move a file that is always in use. Is there a way to either move or delete a file that is in use?
by Zubair Alexander  
1/14/2010 -- Yes, you can move or even delete a file that's in constant use.

Have you ever noticed that sometimes, when you install a hotfix in Windows, you're told that the file will be replaced after the system reboots? That's because the file can't be replaced while it's in use. So Windows offers a MoveFileEx API just for this purpose. The Session Manager is responsible for managing this task by reading the registered rename and delete commands from the registry. The specific location is HKLM\System\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations.

Microsoft offers a couple of tools -- PendMoves and MoveFile -- that work hand-in-hand with and take advantage of the MoveFileEx API. Mark Russinovich wrote these tools for Sysinternals.

To use MoveFile to schedule move and delete commands for the next startup, use the following syntax:

C:\> movefile [source] [dest]

For example, to move a file called report.xls to a folder named Finance use the syntax:

C:\> movefile report.xls Finance\report.xls

The file will be moved the next time your computer is rebooted.

If you want to get rid of a malicious file that won't allow you to delete it, the MoveFile utility will come handy. Simply specify an empty destination (""). By using these quotes with no text between them, the source file is deleted at reboot; because the destination is empty, the file won't be moved to another location on your hard drive and cause problems. It will be sent to the bit bucket and be gone forever.

The PendMoves utility displays moves and deletions that have been scheduled. For example, if you want to view the files that have been configured for move at startup, type "pendmoves" (without the quotes) at the command prompt without any parameters and it'll display the full path of the source and target locations.

The PendMoves and MoveFile tools can be downloaded from Microsoft here.


Zubair Alexander, MCSE, MCT, MCSA and Microsoft MVP is the founder of SeattlePro Enterprises, an IT training and consulting business. His experience covers a wide range of spectrum: trainer, consultant, systems administrator, security architect, network engineer, author, technical editor, college instructor and public speaker. Zubair holds more than 25 technical certifications and Bachelor of Science degrees in Aeronautics & Astronautics Engineering, Mathematics and Computer Information Systems. His Web site, www.techgalaxy.net, is dedicated to technical resources for IT professionals. Zubair may be reached at .

 


More articles by Zubair Alexander:

-- advertisement --


There are 15 CertCities.com user Comments for “Moving, Deleting a File That's Always in Use”
Page 1 of 2
1/22/10: Anonymous says: Good hints, easy to understand and use.
7/1/13: louisvuittonttoutlet.com from [email protected] says: nice articles louisvuittonttoutlet.com http://www.louisvuittonttoutlet.com
7/4/13: gucci outlet store from [email protected] says: good share. gucci outlet store http://www.guccioutletstore-online.com
7/5/13: louboutin outlet from [email protected] says: good share. louboutin outlet http://www.christianlouboutinoutleta.com
7/26/13: Gucci Leder Handtaschen from [email protected] says: good articles Gucci Leder Handtaschen http://www.gucci-online.de/
8/30/13: authentic nfl jerseys from [email protected] says: nice articles authentic nfl jerseys http://www.cheapauthenticnfljerseyss.com
8/31/13: michael kors factory outlet from [email protected] says: good articles michael kors factory outlet http://www.michaelkorseoutlet.org/
9/5/13: moncler jackets sale from [email protected] says: thanks for share! moncler jackets sale http://www.monclerejacketssale.org
9/5/13: nfl wholesale jerseys from [email protected] says: good articles nfl wholesale jerseys http://www.wholesalenflljerseys.com
9/9/13: moncler jackets sale from [email protected] says: thanks for share! moncler jackets sale http://www.moncleresale.org
First Page   Next Page   Last Page
Your comment about: “Moving, Deleting a File That's Always in Use”
Name: (optional)
Location: (optional)
E-mail Address: (optional)
Comment:
   

-- advertisement (story continued below) --

top