generated from abdes/asap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.bat
25 lines (21 loc) · 1011 Bytes
/
init.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
:: Wrapper around `init.ps1` to run the dev environment initialization from
:: command console. Supports environment variables propagation from PowerShell
:: script to the command process via a temp file generated by the PowerShell
:: script.
@echo off
SETLOCAL
set PS1UnderCmd=1
:: Get the datetime in a format that can go in a filename.
set _my_datetime=%date%_%time%
set _my_datetime=%_my_datetime: =_%
set _my_datetime=%_my_datetime::=%
set _my_datetime=%_my_datetime:/=_%
set _my_datetime=%_my_datetime:.=_%
set CmdEnvScriptPath=%temp%\envvarscript_%_my_datetime%.cmd
PowerShell -NoProfile -NoLogo -ExecutionPolicy bypass -Command "try { [System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dpn0.ps1' %*; exit $LASTEXITCODE } catch { write-host $_; exit 1 }"
:: Set environment variables in the parent cmd.exe process.
IF EXIST "%CmdEnvScriptPath%" (
ENDLOCAL
CALL "%CmdEnvScriptPath%"
DEL "%CmdEnvScriptPath%"
)