Wednesday, March 5, 2008

how to rename a file or folder duing boot process using regedit.

There is a way to rename a file or folder during the boot process. For this you need to use the registry editor REGEDIT.EXE.
Create an entry in

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Session Manager\

named PendingFileRenameOperations of type REG_MULTI_SZ. In pre-XP Windows versions you have to use REGEDT32.EXE to create this value type.

The first line of each pair is the current file or folder path and name with \??\ in front of it.

The second line of each pair is the new file or folder path and name with !\??\ in front of it.

Example for one pair which moves the file mfc42.dll from the temp folder to the system32 folder and overwrites any existing file at the destination:

\??\C:\TEMP\mfc42.dll
!\??\C:\WINDOWS\system32\mfc42.dll

You can add as many pairs as you like. The move operation is performed directly after the next reboot. You can also give folder paths, so the folder will be renamed. But both paths have to be local.

There is a Windows API call for this, named MoveFileEx, and somebody in Germany has even written a utility named MoveEx for it. You can download it from http://wwwthep.physik.uni-mainz.de/~frink/nt.html. Use it if you need this function often. A Posix utility from the Windows NT Resource Kit named mv.exe also does it, just in case you still have that resource kit around.



Powered By Blogger