Skip to content

Commit 1272c38

Browse files
authored
Refactor comments and improve script readability
1 parent 2f13f03 commit 1272c38

1 file changed

Lines changed: 6 additions & 22 deletions

File tree

DeployWorkstation.bat

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
REM ========================================================
33
REM DeployWorkstation.bat
44
REM Launcher for DeployWorkstation.ps1
5-
REM Version 5.1 PNWC Edition
5+
REM Version 5.1 - PNWC Edition
66
REM ========================================================
77

88
setlocal enabledelayedexpansion
@@ -12,16 +12,14 @@ echo ===== DeployWorkstation Launcher v5.1 =====
1212
echo.
1313

1414
REM --------------------------------------------------------
15-
REM 1) Elevation check
16-
REM Re-launch this .bat elevated if not already admin.
15+
REM 1) Elevation check - re-launch elevated if not admin
1716
REM --------------------------------------------------------
1817
net session >nul 2>&1
1918
if %errorlevel% neq 0 (
2019
echo Requesting administrative privileges...
2120
echo Please click "Yes" in the UAC prompt.
2221
echo.
23-
powershell.exe -NoProfile -Command ^
24-
"Start-Process -FilePath '%~f0' -Verb RunAs -Wait"
22+
powershell.exe -NoProfile -Command "Start-Process -FilePath '%~f0' -Verb RunAs -Wait"
2523
exit /b
2624
)
2725

@@ -85,29 +83,14 @@ if "%choice%"=="1" (
8583
)
8684

8785
REM --------------------------------------------------------
88-
REM 5) Show what will run, then launch
86+
REM 5) Show parameters then launch
8987
REM --------------------------------------------------------
9088
if "!ps_params!"=="" (
9189
echo Parameters : (none - full run)
9290
) else (
9391
echo Parameters : !ps_params!
9492
)
9593
echo.
96-
echo Verifying script integrity...
97-
REM Pass path via env var so PS resolves it — avoids CMD delayed-expansion
98-
REM mangling of '!' characters in folder names (e.g. Deploy!v5.1\).
99-
set "DEPLOY_PS1=%~dp0DeployWorkstation.ps1"
100-
powershell.exe -NoProfile -Command ^
101-
"$p=$env:DEPLOY_PS1;$null=[System.Management.Automation.Language.Parser]::ParseFile($p,[ref]$null,[ref]$e);if($e){$e|ForEach-Object{Write-Host('SYNTAX ERROR: '+$_.Message)};exit 1}"
102-
set "DEPLOY_PS1="
103-
if %errorlevel% neq 0 (
104-
echo.
105-
echo [ERROR] DeployWorkstation.ps1 has syntax errors - please re-download.
106-
echo.
107-
pause
108-
goto :error_exit
109-
)
110-
11194
echo Starting Windows PowerShell 5.1...
11295
echo.
11396

@@ -146,5 +129,6 @@ REM --------------------------------------------------------
146129
:normal_exit
147130
popd
148131
echo.
149-
pause
132+
echo Press any key to close...
133+
pause >nul
150134
exit /b 0

0 commit comments

Comments
 (0)