terminal icon indicating copy to clipboard operation
terminal copied to clipboard

Doesn't detect pwsh installed in custom directory from Scoop

Open kurame-yotsuba opened this issue 5 years ago • 6 comments

Environment

Windows build number: 10.0.19042.0 Windows Terminal version (if applicable): 1.4.3141.0

PowerShell Core: 7.1.0 Scoop

Steps to reproduce

  1. Installing Scoop to Custom Directory
  2. Install PowerShell Core via Scoop
  3. Open Windows Terminal

Expected behavior

When environment variable SCOOP or SCOOP_GLOBAL is defined, Terminal should search pwsh.exe in %SCOOP% and %SCOOP_GLOBAL% in addition to %USERPROFILE%\scoop.

Actual behavior

Error dialog is opened. The content of error message is "An error occurred while loading the settings." (Sorry, I don't know the message of English version because I use Japanese version).

And, PowerShell is used instead, and PowerShell Core doesn't appear in the shell list.

Searching place is only %USERPROFILE%scoop for Scoop. (ref: PowershellCoreProfileGenerator.cpp Line 281, Tag 1.4.3141.0)

Related issue

#1415

kurame-yotsuba avatar Nov 13 '20 16:11 kurame-yotsuba

Thanks for reporting this! I didn't know about the %scoop% env var and the ability to install scoop to a custom directory. Probably wouldn't be too hard to fix this...

/cc @DHowett

zadjii-msft avatar Nov 16 '20 03:11 zadjii-msft

Is it guaranteed that SCOOP and SCOOP_GLOBAL are set?

Every location we search needs a differentiator; otherwise, we may detect three instances of PowerShell and they'll collapse into one. Right now, we only have one Scoop differentiator.

DHowett avatar Nov 16 '20 03:11 DHowett

I think those variables are not set by default (I don't find them in my system).

From the documentation here, it looks like you can change the directory for user-installed programs and global-installed programs independently.

mpela81 avatar Nov 16 '20 15:11 mpela81

In my case too, those variables were not set by default before changing into custom directory.

Using Scoop, we can install following 4 locations,

  • %USERPROFILE%\scoop (default of user scope),
  • %SCOOP% (custom of user scope),
  • %ProgramData%\scoop (default of global scope),
  • %SCOOP_GLOBAL% (custom of global scope).

To decide which PowerShell is used from these, I think the priorities of search is needed.

kurame-yotsuba avatar Nov 17 '20 14:11 kurame-yotsuba

I think checking %PATH% first would largely solve the problem. pwsh.exe is in PATH by default when installing either way (scoop or official .msi).

JVimes avatar Jun 28 '23 19:06 JVimes

terminal is now able to detect from scoop default directory hence a more generic workaround using mklink (based on https://github.com/microsoft/terminal/issues/1415)

mklink /J "%USERPROFILE%\scoop" "%SCOOP%"

hgtok avatar Jun 02 '25 03:06 hgtok