BubbleGumDancer 0 Posted October 17, 2010 My linkFunc _SelfDelete($iDelay = 0) Local $sCmdFile FileDelete(@TempDir & "\scratch.bat") $sCmdFile = 'ping -n ' & $iDelay & ' 127.0.0.1 > nul' & @CRLF _ & ':loop' & @CRLF _ & 'del "' & @ScriptFullPath & '"' & @CRLF _ & 'if exist "' & @ScriptFullPath & '" goto loop' & @CRLF _ & 'del %0' FileWrite(@TempDir & "\scratch.bat", $sCmdFile) Run(@TempDir & "\scratch.bat", @TempDir, @SW_HIDE) EndFunc;==>_SelfDeleteI tryed to make a script self delete itself but when the function is called it has a line error here :$sCmdFile = 'ping -n ' & $iDelay & ' 127.0.0.1 > nul' & @CRLF _I did not edit it but could I just be applying this function badly? If you were twice as smart, you'd still be stupid. Share this post Link to post Share on other sites
xPloit 0 Posted October 17, 2010 I'm pretty fluent in batch and I think you could make your batch file a bit more stable. It could solve your problem (not sure if it will, but worth a shot). So here is the batch file I would use for something like this timeout /t [TIME IN SECONDS] :Loop if exist [FILE NAME] del [FILE NAME] && del %0 goto Loop I would use timeout instead of ping. It's easier to use and generally more stable The 1st line of the Loop routine is much more stable than what you have. Using a double & will make it so that the 2nd part only happens if the first part happens. If it cannot find your file (or if it cannot delete it) then it will not del %0 and it will move on to the next line (keep looping). Give that batch a try and see if it works for you! 00101101011110000101000001101100011011110110100101110100 Share this post Link to post Share on other sites
Bert 1,430 Posted October 17, 2010 Look in the FAQ sticky. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Share this post Link to post Share on other sites
Borje 10 Posted October 18, 2010 Hi BubbleGum Danser Test this ! Run(@ComSpec & ' /c del ' & @ScriptName, @ScriptDir, @SW_HIDE) ; End of the script Share this post Link to post Share on other sites