bat2exe icon indicating copy to clipboard operation
bat2exe copied to clipboard

Error when running the .exe file created by bat2exe

Open ajdelguidice opened this issue 4 years ago • 5 comments

when I try to run any .exe file created by bat2exe, it gives me this error: 'C:\Users(my username)\AppData\Local\Temp\7zSC0DA0427\error.bat' is not recognized as an internal or external command, operable program or batch file.

  • error.bat is the name of the file I'm trying to convert. I wanted to make a custom error popup into an exe so I called it error.bat.

ajdelguidice avatar Jul 27 '20 16:07 ajdelguidice

Does your username contain spaces or special characters?

islamadel avatar Jul 27 '20 20:07 islamadel

no

ajdelguidice avatar Jul 29 '20 16:07 ajdelguidice

Please provide the code for your batch file and steps to recreate the error. also consider running the exe on a different pc if possible

islamadel avatar Jul 30 '20 08:07 islamadel

if not DEFINED IS_MINIMIZED set IS_MINIMIZED=1 && start "" /min "%~dpnx0" %* && exit @echo off cscript error.vbs exit

The cscript file is the actual error message and its code is as follows: x=msgbox("This application could not be opened",0+16,"Error")

ajdelguidice avatar Jul 30 '20 13:07 ajdelguidice

I realize it's been a couple years, but a few issues I see right away:

  • the space between the 1 and && is going to set IS_MINIMIZED to "1 " so you either need to do 'set IS_MINIMIZED=1&&' or 'set "IS_MINIMIZED=1" &&'
  • You said you're using 'C:\Users(my username)...' which needs to be 'C:\Users(my username)...' (an even better way is to simply use "%userprofile%..."
  • %~dp0 can sometimes be problematic. Is the directory in the error the actual location of error.bat?

vertigo220 avatar Jun 19 '22 23:06 vertigo220