Subject: Re: bug#74550: eshell cannot set the environment variable PATH on Windows

From: Jim Porter <[email-masked]>
Date: Tue, 26 Nov 2024 13:14:42 -0800

On 11/26/2024 12:38 PM, Siyuan Chen wrote:
> Reproduce steps:
> 
> 1. Emacs -Q
> 
> 2. M-x eval-expression `(setenv "PATH" (concat "C:/env" path-separator 
> (getenv "PATH")))`
> 
> 3. M-x eshell
> 
> 4. In the *eshell* window, type `echo $PATH`, but the path "C:/env" 
> doesn't show in the result.

Thanks for the bug report. This is an intentionally-incompatible change 
in Eshell to improve behavior with remote systems via Tramp. Here's the 
relevant section from the Emacs 29 NEWS:

> *** Eshell's PATH is now derived from 'exec-path'.
> For consistency with remote connections, Eshell now uses 'exec-path'
> to determine the execution path on the local or remote system, instead
> of using the PATH environment variable directly.

So instead, you want to do something like '(push "C:/env" exec-path)' in 
order to update the PATH in a way where Eshell sees it.