1 @SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
3 SET CMDLINERUNSTR=%SystemRoot%\system32\cmd.exe
5 DEL script1.log > NUL 2>&1
6 DEL add-paths.log > NUL 2>&1
7 DEL add-paths-detail.log > NUL 2>&1
10 ELEVATE -wait add-paths.bat >> script1.log 2>&1
13 ECHO You denied admin access. Rerun the script, and be sure to press the yes button this time.
15 TYPE add-paths.log 2> NUL
19 :: Branch to UpdateEnv if we need to update
27 :: -----------------------------------------------------------------------------
30 ECHO Making updated PATH go live . . .
31 REG delete HKCU\Environment /F /V TEMPVAR > NUL 2>&1
33 REG delete HKCU\Environment /F /V TEMPVAR > NUL 2>&1
34 IF NOT !cmdcmdline! == !CMDLINERUNSTR! (CALL :KillExplorer)
37 :: -----------------------------------------------------------------------------
44 :: -----------------------------------------------------------------------------
49 ECHO Your desktop will be restarted.
51 ECHO All file explorer windows except for the one you launched this script from WILL BE CLOSED.
53 ECHO Press enter when ready, or close this window if you would rather do a full restart of your computer at a later time.
56 ping -n 5 127.0.0.1 > NUL 2>&1
57 ECHO Killing process Explorer.exe. . .
59 taskkill /f /im explorer.exe > NUL
61 ECHO Your desktop is now loading. . .
63 ping -n 5 127.0.0.1 > NUL 2>&1
65 START explorer.exe %CD%