This i searched and had no luck! Keywords: Delete on Startup, File on Startup...
How do i get a file to be delete in the temp folder on the next startup/login?
Delete file on next startup
- Fluid Byte
- Addict
- Posts: 2336
- Joined: Fri Jul 21, 2006 4:41 am
- Location: Berlin, Germany
Write a little commandline tool, specify the filename and put it in the autostart folder. You can also edit the registry: "Run" & "Run Once"
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
Edit:@abc123 look here: http://www.purebasic.fr/english/viewtopic.php?t=20184This is exported Registry when Kaspersky starts with Windows:Code: Select all
For current user use Registry Key: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce For all users use: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce
Code: Select all
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run] "AVP"="\"C:\\Program Files\\Kaspersky Lab\\Kaspersky Internet Security 7.0\\avp.exe\""
Thanks iNX, i have found something:
Code: Select all
; MSDN: http://msdn2.microsoft.com/en-us/library/aa365240(VS.85).aspx
; MSDN: http://support.microsoft.com/kb/140570
; Move szSrcFile To szDstFile Next time system is rebooted
; MoveFileEx(szSrcFile, szDstFile, MOVEFILE_DELAY_UNTIL_REBOOT);
;
; Delete szSrcFile Next time system is rebooted
; MoveFileEx(szSrcFile, NULL, MOVEFILE_DELAY_UNTIL_REBOOT)
; [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager]
; "PendingFileRenameOperations"=
Procedure ReplaceFile(sSourceFile.s, sDestFile.s)
;SetFileAttributes_(sSourceFile, #FILE_ATTRIBUTE_NORMAL)
MoveFileEx_(sDestFile, #Null, #MOVEFILE_DELAY_UNTIL_REBOOT);
MoveFileEx_(sSourceFile, sDestFile, #MOVEFILE_DELAY_UNTIL_REBOOT)
ProcedureReturn 1
EndProcedure
ReplaceFile(sSourceFile.s, sDestFile.s)
Code: Select all
MoveFileEx_(sDestFile, #Null, #MOVEFILE_DELAY_UNTIL_REBOOT)
Last edited by eJan on Sat Apr 26, 2008 6:13 pm, edited 1 time in total.
if you're familiar with windows API, you could use moveFileEx that does exactly what you need, with a single call.
Code: Select all
BOOL MoveFileEx(
LPCTSTR lpExistingFileName,
LPCTSTR lpNewFileName,
DWORD dwFlags
);
If dwFlags specifies MOVEFILE_DELAY_UNTIL_REBOOT and lpNewFileName is NULL, MoveFileEx registers the lpExistingFileName file to be deleted when the system restarts. If lpExistingFileName refers to a directory, the system removes the directory at restart only if the directory is empty.