But it is a valid switch outside of autoexec.nt.
XP has a way of doing it. But it is only practible to do only the index.dat. Using a batch file or Disk Cleanup (should search on some of my customising posts on DC) an do the others. But as you won't really know the name of all the files it could take days to set up a delete on next boot. So read below for, this is NT's equiv of wininit.ini. But it isn't as smart as 9x.
You stick it in the registry.
If the dwFlags parameter specifies MOVEFILE_DELAY_UNTIL_REBOOT, MoveFileEx stores the locations of the files to be renamed at restart in the following registry value:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations
The function fails if it cannot access the registry.
The PendingFileRenameOperations value is of type REG_MULTI_SZ. Each rename operation stores a pair of NULL-terminated strings. The system uses these registry entries to complete the operations at restart in the same order that they were issued. For example, the following code fragment creates registry entries that delete szDstFile and rename szSrcFile to be szDstFile at restart:
MoveFileEx(szDstFile, NULL, MOVEFILE_DELAY_UNTIL_REBOOT);
MoveFileEx(szSrcFile, szDstFile, MOVEFILE_DELAY_UNTIL_REBOOT);
The system stores the following entries in PendingFileRenameOperations:
szDstFile\0\0
szSrcFile\0szDstFile\0\0Because the actual move and deletion operations specified with the MOVEFILE_DELAY_UNTIL_REBOOT flag take place after the calling application has ceased running, the return value cannot reflect success or failure in moving or deleting the file. Rather, it reflects success or failure in placing the appropriate entries into the registry.
The system deletes a directory tagged for deletion with the MOVEFILE_DELAY_UNTIL_REBOOT flag only if it is empty. To ensure deletion of directories, move or delete all files from the directory before attempting to delete it. Files may be in the directory at boot time, but they must be deleted or moved before the system can delete the directory.
The move and deletion operations are carried out at boot time in the same order they are specified in the calling application. To delete a directory that has files in it at boot time, first delete the files.
Windows 2000/XP: The MoveFileEx function coordinates its operation with the link tracking service, so link sources can be tracked as they are moved.
Windows 95/98/Me: The MoveFileEx function is not supported. To rename or delete a file at restart, use the following procedure.
To rename or delete a file on Windows 95/98/Me
1.. Check for the existence of the WININIT.INI file in the Windows directory.
2.. If WININIT.INI exists, open it and add new entries to the existing [rename] section. If the file does not exist, create the file and create a [rename] section.
3.. Add lines of the following format to the [rename] section:
DestinationFileName=SourceFileNameBoth DestinationFileName and SourceFileName must be short file names. To delete a file, use NUL as the value for DestinationFileName.
The system processes WININIT.INI during system boot. After WININIT.INI has been processed, the system names it WININIT.BAK.
To delete or rename a file, you must have either delete permission on the file or delete child permission in the parent directory. If you set up a directory with all access except delete and delete child and the ACLs of new files are inherited, then you should be able to create a file without being able to delete it. However, you can then create a file, and you will get all the access you request on the handle returned to you at the time you create the file. If you requested delete permission at the time you created the file, you could delete or rename the file with that handle but not with any other.