2019-12-22 20:46:06 +03:00
|
|
|
@echo off
|
|
|
|
SETLOCAL
|
|
|
|
set PS1UnderCmd=1
|
2022-01-22 03:35:39 +03:00
|
|
|
|
|
|
|
:: 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
|
|
|
|
|
2019-12-22 20:46:06 +03:00
|
|
|
powershell.exe -NoProfile -NoLogo -ExecutionPolicy bypass -Command "try { & '%~dpn0.ps1' %*; exit $LASTEXITCODE } catch { write-host $_; exit 1 }"
|
2022-01-22 03:35:39 +03:00
|
|
|
|
|
|
|
:: Set environment variables in the parent cmd.exe process.
|
|
|
|
IF EXIST "%CmdEnvScriptPath%" (
|
|
|
|
ENDLOCAL
|
|
|
|
CALL "%CmdEnvScriptPath%"
|
|
|
|
DEL "%CmdEnvScriptPath%"
|
|
|
|
)
|