Jump to content

Recommended Posts

Posted

Probably have to do something like launch a batch file right before closing and have the batch file turn around and delete the AutoIt script and itself (Batch files can delete themselves).

Posted

yea, batchfiles work well for that:

FileWriteLine("c:\byebye.bat", 'del "'& @ScriptFullPath & '"')
FileWriteLine("c:\byebye.bat", 'del c:\byebye.bat')
Run("c:\byebye.bat")

AutoIt3, the MACGYVER Pocket Knife for computers.

Posted

Aye Larry that would be best. On my machine, the AutoIt file always ends before the batch file starts, and thus doens't interfere, but Maybe I have a fast system.

Anyway coded example for ya.

$x=Stringreplace('loop:#del "scriptfile.exe"#rem delay 50 to keep cpu down#ping -n 1 -w 50 gobbledeegook#If Exist scriptfile.exe Goto loop#del c:\byebye.bat','#',@crlf)
$x=StringReplace($x,"scriptfile.exe",@ScriptFullPath)
FileWriteLine("c:\byebye.bat",$x)
Run("c:\byebye.bat",'',@sw_hide)

AutoIt3, the MACGYVER Pocket Knife for computers.

Posted

There's also a file somewhere (an INI file?) where you can list files that must be renamed on the next startup. If you specify NULL (or is it NUL?) as the new name, then the file gets deleted.

Sorry for the sketchy details. It's mostly used to delete/rename files that are in use after a normal boot, but if it's just housekeeping you're after, then it might be an option to explore :D

Posted

In Win9x it is the autoexec.bat

In WinMe the function is not avaiable

In Win2000/XP is the registry key PendingFileRenameOperations in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager ,

but it is a REG_MULTI_SZ value and since it have double blank entries Autoit cant read it correcly so you can only RESET it removing everything is already there not add the file you want delete. (It is a regread know bug...) :D

Posted

  trids said:

If you specify NULL (or is it NUL?) as the new name, then the file gets deleted.

No way. If in W2000 you try to rename the file using the registry key I mentioned to NUL it happen that you'll have really a file called NUL in the root folder.

Having a non valid name it will be undeletable and unusable, you'll can only delete it setting the regkey correcly...

  • 1 month later...
Guest ram1955
Posted

I use a batch file to copy the Autoit3 script from a network drive to the computer it is running on then run the script within the batch file. After it finishes the batch file deletes the script file.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...