env and PATH
Federico Kircheis
federico@kircheis.it
Fri Dec 20 16:51:48 GMT 2024
Hello to everyone,
I've noticed that env seems to handle the environment variable PATH in a
particular way
-----
> cd /d;
> env -i PATH='C:\Windows;C:\Windows\system32;'
/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe
# in the powershell instance
echo $env:PATH
C;D:\Windows;C;D:\Windows\system32;
----
From this and other examples it seems that env uses for PATH as
separator, then preprends the current drive to all paths that begin with
'\' (thus all of them), and ";" is treated as part of the path
I would like to use the PATH as-is in the invoked program, just like it
is done for other variables, for example
----
cd /d
env -i OPATH='C:\Windows;C:\Windows\system32;'
/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe
# in the powershell instance
echo $env:OPATH
C:\Windows;C:\Windows\system32;
----
in this case OPATH is forwarded as-is to powershell.exe.
I understand that PATH is special, that for cygwin processes some
transformation might be necessary.
But is there any way to achieve what I'm trying?
I search if there is maybe a separation option for telling env to use
PATH as-is, but could not find none.
Best
Federico
More information about the Cygwin
mailing list