forked from microsoft/php-sdk-binary-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
phpsdk-starter.bat
64 lines (47 loc) · 1.5 KB
/
phpsdk-starter.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
@echo off
setlocal enableextensions enabledelayedexpansion
set IMHERE=%~dp0
:getopt
if /i "%1" equ "-h" goto help
if /i "%1" equ "-c" set CRT=%2 & shift
if /i "%1" equ "-a" set ARCH=%2 & shift
if /i "%1" equ "-t" set TASK=%2 & shift
if /i "%1" equ "--task-args" set TASK_ARGS=%2 & shift
shift
if not (%1)==() goto getopt
if "%CRT%" equ "" goto help
if "%ARCH%" equ "" goto help
goto skip_help
:help
echo Usage: phpsdk-starter -c ^<crt^> -a ^<arch^> [-t ^<task_script.bat^>]
exit /b 0
:skip_help
set CRT=%CRT: =%
set ARCH=%ARCH: =%
set PHP_SDK_RUN_FROM_ROOT=1
title PHP SDK
call %IMHERE%bin\phpsdk_setshell.bat %CRT% %ARCH%
if errorlevel 3 (
exit /b %errorlevel%
)
if "%TASK%" neq "" (
if exist "%TASK%" (
set TASK_ARGS=%TASK_ARGS:"=%
if exist "%IMHERE%phpsdk-local.bat" (
cmd /c "!PHP_SDK_VC_SHELL_CMD! && %IMHERE%\bin\phpsdk_setvars.bat && %IMHERE%\phpsdk-local.bat && %TASK% !TASK_ARGS!"
) else (
cmd /c "!PHP_SDK_VC_SHELL_CMD! && %IMHERE%\bin\phpsdk_setvars.bat && %TASK% !TASK_ARGS!"
)
exit /b
) else (
echo could not find the task file
exit /b 3
)
)
if exist "%IMHERE%phpsdk-local.bat" (
cmd /k "!PHP_SDK_VC_SHELL_CMD! && %IMHERE%\bin\phpsdk_setvars.bat && %IMHERE%\bin\phpsdk_dumpenv.bat && %IMHERE%\phpsdk-local.bat && echo. && set prompt=$P$_$+$$$S"
) else (
cmd /k "!PHP_SDK_VC_SHELL_CMD! && %IMHERE%\bin\phpsdk_setvars.bat && %IMHERE%\bin\phpsdk_dumpenv.bat && set prompt=$P$_$+$$$S"
)
set PHP_SDK_RUN_FROM_ROOT=
exit /b