Search the Community
Showing results for tags 'AutoDelete'.
-
Inpired by a script by guinness, here: '?do=embed' frameborder='0' data-embedContent>> he gave me an idea and i did another one for autodelete for some compiled scripts i dont want to execute out of his intended directory (privileges stuff). Thanks ; #FUNCTION# ==================================================================================================================== ; Name .......: __AutoSelfDelete; Author: Zalomalo, inspired in guinness's _SelfRename. ; Description.: AutoDelete executing script because unauthorized bad conditions (bad finemame, wrong path, etc.). ; The purpose is it autodelete as fast as possible and force relog session after return this function, and exiting. ; Is assumed the script is running compiled (exe), and all conditions have been set before. ; Do no error comprobations since have no sense for this purposes. ; Parameters: $iDelay [optional] An integer value for the delay to wait (in seconds) before beging trying to delete the executable. ; Return values: Success - Returns the PID of the bat file. ; Failure - Returns 0 & sets @error to non-zero ; ------------------------------------------------------------------------------------------------------------------------------- Func __AutoSelfDelete($iDelay=1) If Not StringInStr(@ScriptName,'.exe',2) Then Return Local $sTmpBat=@TempDir &'\TmpFile.bat' While FileExists($sTmpBat) $sTmpBat=@TempDir &'\TmpFile'& Chr(Random(65,122,1)) &'.bat' WEnd Local Const $sTmpBatData='@ECHO OFF' &@CRLF _ & 'PING -n '& Int($iDelay) &' -w 1000 127.0.0.1>nul' &@CRLF _ & 'TASKKILL /PID '& @AutoItPID &' /F'&@CRLF _ ; The script must have been exited allready, just by the case & 'DEL /F /Q "'& @AutoItExe &'"' &@CRLF _ & 'DEL /F /Q "'& @TempDir &'\*.bat"' Local Const $hfBat=FileOpen($sTmpBat,2) FileWrite($hfBat,$sTmpBatData) FileClose($hfBat) Return Run($sTmpBat, @TempDir, @SW_HIDE) EndFunc ;==>__AutoSelfDelete
- 5 replies
-
- executable
- running
-
(and 2 more)
Tagged with: