Jump to content

Uninstall Script

Go to solution Solved by T0M50N,

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.

Link to comment
Share on other sites

  • Developers

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.


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
Live for the present,
Dream of the future,
Learn from the past.

Link to comment
Share on other sites

  • Solution

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
Link to comment
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

  • Recently Browsing   0 members

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