I am attempting to make a custom "uninstaller script" using a batch file that will delete specified files, then delete itself after all is said and done. My goal is to make a script that can be converted to EXE format as well. Here is my base script:

rmdir "%DIRECTORYPATH%" /s /q
del "%FILEPATH%" /s /q
(goto) 2>nul & del "%~f0"

With this script, I can get the batch file to delete itself, but not after converting it into executable format with F2KO Software's Bat To Exe Converter. I have tinkered with the settings before compiling the output, but nothing seems to work. The purpose of converting my script to this format is so that I can set a custom icon and version information.

I have even declared set paths in my script, converted it, wrapped the exe in an SFX archive, and set it to extract and run from %TEMP% with no success. The SFX module binds the EXE and doesn't allow self-deletion. I attempted to use this method (originally from @Samy Bencherif) to get around the SFX module running in the background, but this also didn't work:

rmdir "%DIRECTORYPATH%" /s /q
del "%FILEPATH%" /s /q
process.start("cmd /c ping localhost -n 3 > nul & del "%TARGETPATH%")
taskkill /%TARGET%.exe

The list of attempts goes on. I have tried every thing I know, and have been searching for some time now with no fruition. Any help is greatly appreciated.


Aim to the file location then>

DEL App.exe

  • 1
    Already tried that. – Mr. Mendelli Jul 24 '17 at 7:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.