forked from Macad3D/Macad3D
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScriptConsole.cmd
56 lines (46 loc) · 1.16 KB
/
ScriptConsole.cmd
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
@echo off
rem Find MSBuild
setlocal enabledelayedexpansion
set VSWHERE="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
for /f "usebackq tokens=*" %%i in (`%VSWHERE% -latest -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\Roslyn\csi.exe`) do (
set CSIPATH=%%i
)
if not exist "%CSIPATH%" (
echo Cannot find CSI.EXE, please install VisualStudio with MSBuild.
pause
exit /b 1
)
rem Init environment variables
set PATHEXT=%PATHEXT%;.CSX
set MMROOT=%~dp0
cd %MMROOT%\Build
rem Start
if not %1.==. (
set CMD=%*
call:execute
echo Script returned with error code !ERRORLEVEL!.
exit /b !ERRORLEVEL!
)
echo -
echo - Macad3D build script console.
echo - Enter 'help' for available commands.
echo -
:loopstart
set CMD=
set /P CMD="> "
if /I "%CMD%"=="exit" goto loopend
if /I "%CMD%"=="quit" goto loopend
call:execute
goto loopstart
:loopend
exit /b 0
:execute
for /f "tokens=1*" %%a in ("%CMD%") do (
echo.%%a| find /I ".csx">nul && ( set SCR=%%a ) || ( set SCR=%%a.csx )
if not exist "!SCR!" (
echo Invalid script name.
goto loopstart
)
"%CSIPATH%" !SCR! %%b
)
goto:eof