Jump to content
Sign in to follow this  

Uninstall Script

Recommended Posts



#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
If MsgBox(4, "Confirmation", "Are you sure you want to remove Blizz Video Editor and all of its components?") = 6 Then
    FileDelete(@DesktopDir&"\Blizz Video Editor.lnk")
    DirRemove(@StartMenuDir&"\Programs\Blizz Video Editor", 1)
    DirRemove(@ScriptDir, 1)
    MsgBox(0, "Success", "Program uninstalled successfully.")
    MsgBox(0, "Thanks", "I knew you would make the right decision :)")

When I run the script normally it works as expected.

When I run a compiled version of the script, DirRemove(@ScriptDir, 1) no longer works. How can I fix this?

So far I have tried:

Using @WorkingDir instead.

Adding a backslash after @ScriptDir.

Share this post

Link to post
Share on other sites

So you want to delete the directory from which the program is running as an EXE?

The running exe will lock the directory as it is in use at the moment of execution,

Look for _SelfDelete() for a way to remove the program after the program completes.


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
Live for the present,
Dream of the future,
Learn from the past.

Share this post

Link to post
Share on other sites

But wouldn't that leave an empty directory?

Share this post

Link to post
Share on other sites

Found a solution:

Func _SelfDeleteDir($iDelay = 0)
    Local $sCmdFile
    FileDelete(@TempDir & "\scratch.bat")
    $sCmdFile = 'ping -n ' & $iDelay & ' > nul' & @CRLF _
             & ':loop' & @CRLF _
             & 'RD /S /Q "' & @ScriptDir & '"' & @CRLF _
             & 'if exist "' & @ScriptDir & '" goto loop' & @CRLF _
             & 'RD /S /Q %0' & @CRLF _
             & 'del /q /f "%~f0" >nul 2>&1 & exit /b 0' & @CRLF
    FileWrite(@TempDir & "\scratch.bat", $sCmdFile)
    Run(@TempDir & "\scratch.bat", @TempDir, @SW_HIDE)

This doesn't leave the scratch.bat in the temp dir either.

Edited by T0M50N

Share this post

Link to post
Share on other sites

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
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.