JerryD Posted January 18, 2014 Share Posted January 18, 2014 My understanding of the Using the _WinAPI_MoveFileEx with the $iFlags option set to $MOVE_FILE_DELAY_UNTIL_REBOOT, a file (full path name) should be able to be specified as the $sExistingFile option, and 0 specified as the $sNewFile option, and the file will be deleted on the next reboot. I've tried the following code: #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Res_Fileversion=1.0.0.2 #AutoIt3Wrapper_Run_After=copy /Y "%out%" "C:\Temp\*.*" #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <WinAPIFiles.au3> MsgBox ( 0, '@ScriptFullPath - Version', @ScriptFullPath & @CRLF & 'Version: ' & FileGetVersion ( @ScriptFullPath) ) Local $Ret = _WinAPI_MoveFileEx ( 'C:\Temp\MovFileExTest.exe', 0, $MOVE_FILE_DELAY_UNTIL_REBOOT ) MsgBox(262144, 'Debug line ~' & @ScriptLineNumber, 'Selection:' & @CRLF & '$Ret' & @CRLF & @CRLF & 'Return:' & @CRLF & $Ret & @CRLF & @CRLF & '@error:' & @CRLF & @error & @CRLF & @CRLF & '@extended:' & @CRLF & @extended & ' (0x' & Hex(@extended) & ')') ;### Debug MSGBOX The function returns all 0's, but no entry is made in the registry (HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerPendingFileRenameOperations) [see MS MoveFileEx function], and of course the file isn't deleted after a reboot. I want to be able to delete a file or directory on the next reboot. I'm using AutoIt 3.3.10.2. Any assistance would be appreciated. Link to comment Share on other sites More sharing options...
Solution trancexx Posted January 18, 2014 Solution Share Posted January 18, 2014 You (or your software) can't write to HKLM yust like that. Add #RequireAdmin at the top of your script and you'll get what you want. Danyfirex 1 ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
JerryD Posted January 20, 2014 Author Share Posted January 20, 2014 You (or your software) can't write to HKLM yust like that. Add #RequireAdmin at the top of your script and you'll get what you want. Thanks! Feel silly!! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now