My application needs to delete some files, but this should happen until next windows startup.
What I\'m doing now is to write this string value in RunOnce registry k
Don't use RunOnce
, and don't use Command.com
. If you insist on using something, use %COMSPEC% /c
instead. You have a better option, though.
Use MoveFileEx with the MOVEFILE_DELAY_UNTIL_REBOOT
flag instead:
if not MoveFileEx(PChar(YourFileToDelete), nil, MOVEFILE_DELAY_UNTIL_REBOOT) then
SysErrorMessage(GetLastError);