Reputation: 3782
I like to portable-ise as many programs / apps as I can, so I regularly create self-executing SFX archives that extract to %temp%
and then run a selected file (usually the original .exe or, if necessary, a .bat file).
I'm trying to combine a x86 and x64 version of an app into one version, as I don't like having 2 files. So, I have 2 folders ("x86" and "x64") containing the different versions of the program and a .bat file in the root that will check the user's bitness and then launch the appropriate version. I'm having a few issues, though.
Here is my code:
checkandrun.bat
@echo off
goto Payload
:Payload
echo Checking architecture bit-type...
IF EXIST "%systemRoot%\SysWOW64" (
echo Your version of Windows is 64-bit [x64]
start "x64\GCFScape.exe" >nul
) ELSE (
echo Your version of Windows is 32-bit [x86]
start "x86\GCFScape.exe" >nul
)
echo.
echo Starting the appropriate version...
goto End
:End
echo.
echo This window will close in 20 seconds.
ping localhost -n 21 >nul
exit
If I use start
then the original command window will exit correctly, as desired, but will open up a new, constant command window and the app won't launch.
If I don't use start
the app will launch but the command window will stay open and won't progress past the line of code that was used to launch the .exe. If I close the app itself then the command window will proceed as normal to the exit
command and close successfully.
Is there is a way around this? I've never had this kind of problem before.
Here is a link to the SFX archive in my Dropbox, if anyone wants to take an actual look at the environment and effects for themselves: https://dl.dropbox.com/u/27573003/Social%20Distribution/gcfscape182.exe
Upvotes: 2
Views: 5204
Reputation: 6734
The docs for the START command say that the first arg that is in quote marks will be the title of the window. So, try this:
start /B "GCFScape" "x64\GCFScape.exe">nul
Upvotes: 7