In tip 0578, I described the PendingFileRenameOperations Value Name, which is used to rename or delete files that are in-use, at the next Windows restart.
To configure PendingFileRenameOperations from a CMD prompt or batch script, download and unzip moveex.zip. Move moveex.exe to a folder in your PATH.
When you open a CMD prompt and type moveex /?, you receive:
Version 1.0, Copyright (C)2001, Frank P. Westlake. Registers file move operations to be accomplished during the next system start. MoveEx \[existing-file \[new-file\]\] \[/d # \[/DeleteAllOK\]\] existing-file Complete path to the file to move or to delete. new-file Complete path to the new filename. If new-file exists it will be overwritten unless the /o option is included. If new-file is not specified, existing-file will be deleted. /d Delete the entry number from the list of pending operations. /DeleteAllOK Do not ask if OK to delete all entries. /o Do not overwrite new-file if it exists. With no parameters the current pending rename operations are printed. The /d option will delete an individual entry if # is greater than 0. If # is 0 (zero), all entries will be deleted after verification from the user. User verification can be included on the command line with the /DeleteAllOK option. Pending rename operations are stored in: WINNT: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager PendingFileRenameOperations Windows9x: %WINDIR%\WININIT.INI \[Rename\] Examples: MoveEx %SystemRoot%\Memory.dmp &REM Delete MoveEx C:\temp\NewExplorer.exe %SystemRoot%\Explorer.exe &REM Rename MoveEx &REM List entries MoveEx /d 0 &REM Delete entries