From: Thangalin <thangalin@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Update setpath to set the path
Date: Sun, 9 May 2021 16:50:55 -0700 [thread overview]
Message-ID: <CAANrE7oX7GG8TtHYYmL3KHdpZhjG6_UFn+75VTYdvz7gNNVdUA@mail.gmail.com> (raw)
In-Reply-To: <CAANrE7pq+HfjK0KgGULCGkNXpNjXySLv9y0W_voWiL5j46G9nA@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 1221 bytes --]
Here's a version that persits the current user's PATH (i.e., not
system-wide):
rem SOF
@echo off
set "OWNPATH=%~dp0"
set "PLATFORM=mswin"
if defined ProgramFiles(x86) set "PLATFORM=win64"
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" set "PLATFORM=win64"
if exist "%OWNPATH%tex\texmf-mswin\bin\context.exe" set "PLATFORM=mswin"
if exist "%OWNPATH%tex\texmf-win64\bin\context.exe" set "PLATFORM=win64"
set "TeXPath=%OWNPATH%tex\texmf-%PLATFORM%\bin"
echo %PATH% | findstr "texmf-%PLATFORM%" > nul
rem Only update the PATH if not previously updated
if ERRORLEVEL 1 (
setlocal enabledelayedexpansion
set "Exists=false"
set "Key=HKCU\Environment"
for /F "USEBACKQ tokens=2*" %%A in (`reg query %%Key%% /v PATH 2^>nul`)
do (
if not "%%~B" == "" (
set "Exists=true"
rem Preserve the existing PATH
echo %%B > currpath.txt
rem Change the PATH environment variable
setx PATH "%%B;%TeXPath%"
)
)
rem The user-defined PATH does not exist, create it
if "!Exists!" == "false" (
rem Change the user PATH environment variable
setx PATH "%TeXPath%"
)
endlocal
rem Update the current session
set "PATH=%PATH%;%TeXPath%"
)
rem EOF
[-- Attachment #1.2: Type: text/html, Size: 1994 bytes --]
[-- Attachment #2: Type: text/plain, Size: 493 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
next prev parent reply other threads:[~2021-05-09 23:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-09 19:14 Thangalin
2021-05-09 23:50 ` Thangalin [this message]
2021-05-10 7:00 ` Aditya Mahajan
2021-05-10 7:18 ` Thangalin
2021-05-10 7:40 ` Hans Hagen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAANrE7oX7GG8TtHYYmL3KHdpZhjG6_UFn+75VTYdvz7gNNVdUA@mail.gmail.com \
--to=thangalin@gmail.com \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).