https://bugs.winehq.org/show_bug.cgi?id=45810
--- Comment #4 from Aaron Simmons paleozogt@gmail.com --- Thanks for looking into it. :)
I"m a bit confused by the 1024 limit... I guess its there to emulate some limit that's thought to be in Windows? While setx (and other APIs?) maybe have a 1024 limit, the PATH env var itself doesn't seem to have that limit.
For example, on my Windows 10 dev system, I have a PATH that's 1574 characters:
C:\Users\vagrant>echo %PATH% C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program Files (x86)\MSBuild\12.0\bin;C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE;C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\x86_amd64;C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN;C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools;C:\Windows\Microsoft.NET\Framework\v4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\VCPackages;C:\Program Files (x86)\Microsoft Visual Studio 12.0\Team Tools\Performance Tools;C:\Program Files (x86)\Windows Kits\8.1\bin\x86;C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\x64;C:\Python27;C:\Python27\Scripts;C:\Python37\Scripts;C:\Python37;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\ProgramData\chocolatey\bin;C:\Program Files\Microsoft SQL Server\110\Tools\Binn;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0;C:\Program Files\Microsoft SQL Server\120\Tools\Binn;C:\Users\vagrant\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\GnuWin32\bin;;C:\Program Files\Notepad++;C:\Program Files\Git\bin;C:\Program Files\Git LFS;C:\swigwin-3.0.11;C:\Program Files\CMake\bin;C:\Program Files\Java\jdk1.8.0_181\bin;C:\Program Files\doxygen\bin;C:\Users\vagrant\AppData\Local\Pandoc;C:\Program Files (x86)\Graphviz2.38\bin;C:\Program Files\MiKTeX 2.9\miktex\bin\x64;C:\Users\vagrant\AppData\Local\Microsoft\WindowsApps;C:\Users\vagrant\AppData\Local\Pandoc\
Which, as you pointed out, causes grief with setx:
C:\Users\vagrant>setx PATH "%PATH%;C:\foobar"
WARNING: The data being saved is truncated to 1024 characters.
SUCCESS: Specified value was saved.
But that inability for some older parts of Windows to work with long PATHs seems to be expected behavior (!).