Doesn't detect pwsh installed in custom directory from Scoop #11396

Open
opened 2026-01-31 02:46:27 +00:00 by claunia · 6 comments
Owner

Originally created by @kurame-yotsuba on GitHub (Nov 13, 2020).

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

Originally created by @kurame-yotsuba on GitHub (Nov 13, 2020). # 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](https://github.com/lukesampson/scoop/wiki/Quick-Start#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](https://github.com/microsoft/terminal/blob/v1.4.3141.0/src/cascadia/TerminalApp/PowershellCoreProfileGenerator.cpp) Line 281, Tag 1.4.3141.0) # Related issue #1415
Author
Owner

@zadjii-msft commented on GitHub (Nov 16, 2020):

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 commented on GitHub (Nov 16, 2020): 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
Author
Owner

@DHowett commented on GitHub (Nov 16, 2020):

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 commented on GitHub (Nov 16, 2020): 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.
Author
Owner

@mpela81 commented on GitHub (Nov 16, 2020):

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 commented on GitHub (Nov 16, 2020): I think those variables are not set by default (I don't find them in my system). From the documentation [here](https://github.com/lukesampson/scoop#install-scoop-to-a-custom-directory-by-changing-scoop), it looks like you can change the directory for user-installed programs and global-installed programs independently.
Author
Owner

@kurame-yotsuba commented on GitHub (Nov 17, 2020):

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 commented on GitHub (Nov 17, 2020): 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.
Author
Owner

@JVimes commented on GitHub (Jun 28, 2023):

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 commented on GitHub (Jun 28, 2023): 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).
Author
Owner

@hgtok commented on GitHub (Jun 2, 2025):

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 commented on GitHub (Jun 2, 2025): 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%" ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#11396