Advertisement
Guest User

Untitled

a guest
May 9th, 2021
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. echo off
  2. set OWNPATH=%~dp0
  3. set PLATFORM=mswin
  4.  
  5. if defined ProgramFiles(x86)                        set PLATFORM=win64
  6. if "%PROCESSOR_ARCHITECTURE%"=="AMD64"              set PLATFORM=win64
  7. if exist "%OWNPATH%tex\texmf-mswin\bin\context.exe" set PLATFORM=mswin
  8. if exist "%OWNPATH%tex\texmf-win64\bin\context.exe" set PLATFORM=win64
  9.  
  10. echo %PATH% | findstr "texmf-%PLATFORM%" > nul
  11.  
  12. rem Only update the PATH if not previously updated
  13. if ERRORLEVEL 1 (
  14.   set Key="HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment"
  15.   set "CurrPath="
  16.   for /F "USEBACKQ tokens=2*" %%A in (`reg query %%Key%% /v PATH`) do (
  17.     if not "%%~B" == "" (
  18.       rem Preserve the existing PATH
  19.       echo %%B > currpath.txt
  20.  
  21.       rem Update the current session
  22.       set PATH=%PATH%;%OWNPATH%tex\texmf-%PLATFORM%\bin
  23.      
  24.       rem Change the PATH environment variable
  25.       setx PATH "%%B;%OWNPATH%tex\texmf-%PLATFORM%\bin" /M
  26.     )
  27.   )
  28. )
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement