upload
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

1-setup-path-win.bat 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. @SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
  2. @ECHO OFF
  3. SET CMDLINERUNSTR=%SystemRoot%\system32\cmd.exe
  4. CD UTIL
  5. DEL add-paths.log > NUL 2>&1
  6. DEL add-paths-detail.log > NUL 2>&1
  7. DEL UPDATE > NUL 2>&1
  8. ELEVATE -wait %cd%\add-paths.bat > NUL 2>&1
  9. IF ERRORLEVEL 1 (
  10. ECHO You denied admin access. Rerun the script, and be sure to press the yes button this time.
  11. ) ELSE (
  12. TYPE add-paths.log 2> NUL
  13. )
  14. ECHO.
  15. :: Branch to UpdateEnv if we need to update
  16. IF EXIST UPDATE (
  17. DEL UPDATE
  18. GOTO UpdateEnv
  19. )
  20. GOTO ExitBatch
  21. :: -----------------------------------------------------------------------------
  22. :UpdateEnv
  23. ECHO Making updated PATH go live . . .
  24. REG delete HKCU\Environment /F /V TEMPVAR > NUL 2>&1
  25. setx TEMPVAR 1 > NUL
  26. REG delete HKCU\Environment /F /V TEMPVAR > NUL 2>&1
  27. IF NOT !cmdcmdline! == !CMDLINERUNSTR! (CALL :KillExplorer)
  28. GOTO ExitBatch
  29. :: -----------------------------------------------------------------------------
  30. :ExitBatch
  31. ENDLOCAL
  32. PAUSE
  33. EXIT /b
  34. :: -----------------------------------------------------------------------------
  35. :KillExplorer
  36. ECHO Your desktop will be restarted.
  37. ECHO All file explorer windows except for the one you launched this script from WILL BE CLOSED.
  38. ECHO Press enter when ready, or close this window if you would rather do a full restart of your computer at a later time.
  39. PAUSE
  40. ping -n 5 127.0.0.1 > NUL 2>&1
  41. ECHO Killing process Explorer.exe. . .
  42. ECHO.
  43. taskkill /f /im explorer.exe > NUL
  44. ECHO.
  45. ECHO Your desktop is now loading. . .
  46. ECHO.
  47. ping -n 5 127.0.0.1 > NUL 2>&1
  48. START explorer.exe
  49. START explorer.exe %CD%\..
  50. EXIT /b