From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/111302 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Thangalin Newsgroups: gmane.comp.tex.context Subject: Re: Update setpath to set the path Date: Sun, 9 May 2021 16:50:55 -0700 Message-ID: References: Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2404374137592798418==" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5589"; mail-complaints-to="usenet@ciao.gmane.io" To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Mon May 10 01:51:48 2021 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane-mx.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lftDA-0001Lc-I4 for gctc-ntg-context-518@m.gmane-mx.org; Mon, 10 May 2021 01:51:48 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id D21F8283545; Mon, 10 May 2021 01:51:23 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BrFezadL9sOZ; Mon, 10 May 2021 01:51:22 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id C58E92835AA; Mon, 10 May 2021 01:51:21 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 28EBC2835AA for ; Mon, 10 May 2021 01:51:10 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uzJmmYnIqCF8 for ; Mon, 10 May 2021 01:51:08 +0200 (CEST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.210.49; helo=mail-ot1-f49.google.com; envelope-from=thangalin@gmail.com; receiver= Original-Received: from mail-ot1-f49.google.com (mail-ot1-f49.google.com [209.85.210.49]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 26927283545 for ; Mon, 10 May 2021 01:51:08 +0200 (CEST) Original-Received: by mail-ot1-f49.google.com with SMTP id d3-20020a9d29030000b029027e8019067fso12860047otb.13 for ; Sun, 09 May 2021 16:51:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=UBeL0Kopngscwg4TyErGW+Axzhh/wjE7dtVyfZ0pchE=; b=pp3FptHnSo81h6WgEXCGsePKu9cpbFaOeCHs9Xi5xh+4KY51zg3Xvjk4yhzwkvqPSX tgIo6OqEbBvlQ/F2PoCeq4MZCYjFH91sdgpKxAQQUVFHTtjfblQ0Vq+3nmHe3CZOJOb4 lGuqYG8h8o3VgIedlTiRlRgFo5eYnSdbEq3+axeEL8TU83uFVE8FqZH1SXdJVpvh53L9 apL79U8FTrz4aQGV4EJu0wTNcTonjq1J0YCNEtY7BzVUNluJ9kK1d9rq4oVDHLblVLv2 ZIiaHevcE+ILBfx9EaSpkNBc1Qalg45nx1EgUFB++rrR//EdYDjH2bYWWZxq2cNYIhVa T3cA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=UBeL0Kopngscwg4TyErGW+Axzhh/wjE7dtVyfZ0pchE=; b=h1LCOhffZ7umjUokfu/44iVZSRs3FSN5XncXHlVSSE5EXuSwWZnyssWZaAgovSwS3b Bep5SNvL766JdLZfeV+BhudENOc1UJGJGj2xGcIqffL0W7+S9AP3oq/8cWbFmiFMZxBm TwHoLM3ukDWKzFFdonyEGP1zEXAdHcLClc1nM5UKRT8B1HNHwSMKKslFbZU2GWKbZEaC U6/5QpjDQh+CLnqsxANju3n1hE2DOk6P2PVocwqolKu8THRGe8fQ1OOgxHItC3F39tYH Qdd5Z0FN1V1np3ZOpxPuPS6ysGgvbNkskRZFP/Xj+C8G/FHGEcJNT3ZyZnWBMVB8yw1h bdMQ== X-Gm-Message-State: AOAM531bUR2luv+RSGNkcVy9FZtujbz9HzQWZlf4ZcClbFX5UE2OZKLY GTjfkwiShQnJ8dzEjWbmlemlvqdSG/GuygZMKKucNQNHdoY= X-Google-Smtp-Source: ABdhPJzR+J/xn4Opq8SBEaCk/xoQplGFiYU7GVYbMl+ZnHpZBLZuqyJpK+h1B4ygmAeo0FGLutN9jAiHQqzkPyPrQeE= X-Received: by 2002:a9d:5a10:: with SMTP id v16mr18690900oth.187.1620604266300; Sun, 09 May 2021 16:51:06 -0700 (PDT) In-Reply-To: X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.26 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.io gmane.comp.tex.context:111302 Archived-At: --===============2404374137592798418== Content-Type: multipart/alternative; boundary="0000000000009d4a3f05c1ee555e" --0000000000009d4a3f05c1ee555e Content-Type: text/plain; charset="UTF-8" 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 --0000000000009d4a3f05c1ee555e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Here's a version that persits the current user= 9;s PATH (i.e., not system-wide):

rem SOF
@echo off
set "OWNPATH=3D%~dp0"
set "PLATFORM=3Dmswin"
=
if defined ProgramFiles(x86) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0set "PLATFORM=3Dwin64"if "%PROCESSOR_ARCHITECTURE%"=3D=3D"AMD64" =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0set "PLATFORM=3Dwin64"
i= f exist "%OWNPATH%tex\texmf-mswin\bin\context.exe" set "PLAT= FORM=3Dmswin"
if exist "%OWNPATH%tex\texmf-win64\bin\context.e= xe" set "PLATFORM=3Dwin64"

set "TeXPath=3D%OWNPA= TH%tex\texmf-%PLATFORM%\bin"

echo %PATH% | findstr "texmf-= %PLATFORM%" > nul

rem Only update the PATH if not previously= updated
if ERRORLEVEL 1 (
=C2=A0 setlocal enabledelayedexpansion
= =C2=A0 set "Exists=3Dfalse"
=C2=A0 set "Key=3DHKCU\Enviro= nment"

=C2=A0 for /F "USEBACKQ tokens=3D2*" %%A in (`= reg query %%Key%% /v PATH 2^>nul`) do (
=C2=A0 =C2=A0 if not "%%= ~B" =3D=3D "" (
=C2=A0 =C2=A0 =C2=A0 set "Exists=3Dt= rue"

=C2=A0 =C2=A0 =C2=A0 rem Preserve the existing PATH
=C2= =A0 =C2=A0 =C2=A0 echo %%B > currpath.txt

=C2=A0 =C2=A0 =C2=A0 re= m Change the PATH environment variable
=C2=A0 =C2=A0 =C2=A0 setx PATH &q= uot;%%B;%TeXPath%"
=C2=A0 =C2=A0 )
=C2=A0 )

=C2=A0 rem Th= e user-defined PATH does not exist, create it
=C2=A0 if "!Exists!&q= uot; =3D=3D "false" (
=C2=A0 =C2=A0 rem Change the user PATH e= nvironment variable
=C2=A0 =C2=A0 setx PATH "%TeXPath%"
=C2= =A0 )

=C2=A0 endlocal

=C2=A0 rem Update the current session=C2=A0 set "PATH=3D%PATH%;%TeXPath%"
)
rem EOF
<= /div> --0000000000009d4a3f05c1ee555e-- --===============2404374137592798418== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCg== --===============2404374137592798418==--