Page 2 of 2
Re: newbie min cmd window?
Posted: 23 Feb 2019 09:10
by Ed Dyreen
Nicodemus wrote: ↑23 Feb 2019 08:42
thank you for your help. this works so im happy but I want to learn. how would I make it into a single batch file?
Code: Select all
@echo off
for /F "tokens=3 delims=:" %%? in (
"%~0"
) do if %%? EQU getParams (
start "" "E:\LaunchBox\Games\Big Fish Games\Launchers\Blackie.exe"
start "my game" /WAIT "E:\12noon Display Changer\dc64.exe" -width=1280 -height=720 /c "E:\LaunchBox\Games\Big Fish Games\Mystery Case Files - Return to Ravenhearst FINAL\ReturnToRavenhearst.exe"
taskkill /IM Blackie.exe
exit 0
)
>nul break | ( start "" /MIN "%~d0\:getParams:\..\%~pnx0" )
::
exit 0
This is already a bit complex, to understand what is happening
read this
I wonder if this is the shortest way to do this actually, I'd be interested if someone else prop up a more elegant or efficient solution
Re: newbie min cmd window?
Posted: 23 Feb 2019 09:30
by aGerman
Similar but using an additional argument:
Code: Select all
@echo off &setlocal
if "%~1" neq "__MINIMIZED__" (start /min cmd /c "%~f0" __MINIMIZED__ %*&exit /b)
shift /1
:: your code here:
echo I'm minimized.
pause
You still can't avoid the flashing window of the first instance. Consider to use a shortcut to your batch file where it would be just a setting ("Run" property).
Steffen
Re: newbie min cmd window?
Posted: 23 Feb 2019 09:54
by Ed Dyreen
Ah yes, aGeman's is better, and can be even shorter because you do not even need args.
Code: Select all
@echo off &if "%~1" neq "MIN" start /MIN cmd /c "%~f0" MIN &exit /b
start "" "E:\LaunchBox\Games\Big Fish Games\Launchers\Blackie.exe"
start "my game" /WAIT "E:\12noon Display Changer\dc64.exe" -width=1280 -height=720 /c "E:\LaunchBox\Games\Big Fish Games\Mystery Case Files - Return to Ravenhearst FINAL\ReturnToRavenhearst.exe"
taskkill /IM Blackie.exe
exit 0
Thanks a, I knew I was forgetting something obvious
Re: newbie min cmd window?
Posted: 24 Feb 2019 06:29
by aGerman
In case parameter handling or the content of cmdcmdline matters, you still can use a variable.
Code: Select all
if not defined __MINIMIZED__ set __MINIMIZED__=1&start /min cmd /c "%~f0" %*&exit /b
Steffen
Re: newbie min cmd window?
Posted: 25 Feb 2019 16:40
by Nicodemus
thanks for everyone's help, I learned a lot.