Prerequisites
Steps to reproduce
On Windows
- Open an elevated pwsh session, and create 2 symbolic links as follows in a folder:
New-Item -ItemType SymbolicLink -Path pwsh-symlink -Value $pshome\pwsh.exe
New-Item -ItemType SymbolicLink -Path pwsh-double-link -Value .\pwsh-symlink
- Under the same folder, run
.\pwsh-symlink, and you will see pwsh console window pops up.
- Under the same folder, run
.\pwsh-double-link, and you will see the "How do you want to open this file" window pops up.
Note: Start-Process doesn't use the final target of a symbolic link either.
However, it works fine on Unix
- Create 2 symbolic links as follows in a folder:
/bin/ln -s /opt/microsoft/powershell/7/pwsh pwsh-link
/bin/ln -s /home/<user>/tmp/pwsh-link /home/<user>/tmp/pwsh-double
- Under the same folder, run
./pwsh-link -c 1+1, and you will get 2 printed out as the result.
- Under the same folder, run
./pwsh-double -c 1+1, and you will get 2 printed out as the result.
Expected behavior
On Windows:
1. pwsh should know that `pwsh-symlink` is actually a console application, and run into with the current console.
2. pwsh should be able to run `pwsh-double-link`, just like on Unix platforms.
Actual behavior
On Windows
1. pwsh opens `pwsh-symlink` in a separate console window, which means it doesn't use the link target to check if it's a console application, and thus starts the process with 'UseShellExecute = true'.
2. pwsh cannot run `pwsh-double-link`, because when using `UseShellExecute`, the Shell automatically uses the immediate link target of a symbolic link file, but doesn't do recursive resolution when the immediate link target is again a symbolic link.
Error details
No response
Environment data
The latest build from master, and happen on all 7.2.0-preview.9 as well
Visuals


Prerequisites
Steps to reproduce
On Windows
.\pwsh-symlink, and you will see pwsh console window pops up..\pwsh-double-link, and you will see the "How do you want to open this file" window pops up.However, it works fine on Unix
./pwsh-link -c 1+1, and you will get2printed out as the result../pwsh-double -c 1+1, and you will get2printed out as the result.Expected behavior
Actual behavior
Error details
No response
Environment data
Visuals