Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Use of $env:COMSPEC may be invalid in some cases. #36

Closed
u1f992 opened this issue Nov 28, 2023 · 2 comments
Closed

Use of $env:COMSPEC may be invalid in some cases. #36

u1f992 opened this issue Nov 28, 2023 · 2 comments

Comments

@u1f992
Copy link

u1f992 commented Nov 28, 2023

In certain environments, this will be reproduced by running the installer as usual and launching Pico - Developer PowerShell.

Sorry for the Japanese UI, but it says "The expression after '&' in a pipeline element produced an object that was not valid. It must result in a command name, a script block, or a CommandInfo object."

image

This indicates that $env:COMSPEC is not defined. In fact, echo $env:COMSPEC did not print anything. Of course, I did not intentionally erase it... perhaps.

The disappearance seems to be a common occurrence, as evidenced by reports of similar problems occurring in other projects (other 3rd party applications supposedly erasing it? I have not investigated further).
ref: ScoopInstaller/Scoop#3845

Anyway, $env:COMSPEC is just an environment variable, and since it can disappear or contain strange things, some people think it is wise to specify cmd.exe directly if we obviously know we will use it.
ref: ScoopInstaller/Scoop#4692

@ndabas
Copy link
Contributor

ndabas commented Nov 28, 2023

Thanks for the bug report/debugging and resolution! I will fix this for the next release.

@u1f992
Copy link
Author

u1f992 commented Aug 15, 2024

@ghollingworth No modifications have been made since this issue was opened, and $env:COMSPEC is still being used.

& "${env:COMSPEC}" /s /c "`"$PSScriptRoot\pico-env.cmd`" && set" | ForEach-Object {

Could you please explain why this issue was closed as completed?

Sorry, I saw your update to the README. It is unfortunate that support for pico-setup-windows is being discontinued.

ndabas added a commit to ndabas/pico-setup-windows that referenced this issue Aug 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants