Wednesday, August 27, 2008

AHK - Make a script delete itself

With these few lines of code put in your OnExit label, your script will automatically delete itself when it exits. All it does is create a batch file and run it as soon as the script exits.
FileAppend, DEL "%A_ScriptFullPath%"`nDEL "%A_ScriptDir%\del.bat", %A_ScriptDir%\del.bat
Loop {
if (FileExist(A_ScriptDir "\del.bat"))
break
}
Run, del.bat,, Hide
Exitapp
Forum Post

No comments: