Implement the run helper as a script
[geany-mirror.git] / src / geany-run-helper.bat
blob55162b6fd0e2709557e2f226dbc8b11d587b1338
1 REM USAGE: geany-run-helper AUTOCLOSE COMMAND...\r
2 \r
3 REM save autoclose option and remove it\r
4 set autoclose=%1\r
5 shift\r
6 \r
7 REM spawn the child\r
8 REM it's tricky because shift doesn't affect %*, so hack it out\r
9 REM https://en.wikibooks.org/wiki/Windows_Batch_Scripting#Command-line_arguments\r
10 set SPAWN=\r
11 :argloop\r
12 if -%1-==-- goto argloop_end\r
13         set SPAWN=%SPAWN% %1\r
14         shift\r
15 goto argloop\r
16 :argloop_end\r
17 %SPAWN%\r
19 REM show the result\r
20 echo:\r
21 echo:\r
22 echo:------------------\r
23 echo:(program exited with code: %ERRORLEVEL%)\r
24 echo:\r
26 REM and if wanted, wait on the user\r
27 if not %autoclose%==1 pause\r