Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shift+Right-Click context menu "Open in Terminal" and "Open in PowerShell" break #3176

Open
Compleur opened this issue Jan 26, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@Compleur
Copy link

Compleur commented Jan 26, 2025

Describe the bug

Shift+Right-Click context menu "Open in Terminal" and "Open in PowerShell" break with brackets or spaces in folder names.
This may be related to 'Set-Location' and/or 'cd' commands

Steps to reproduce

PowerShell Example Error:

  1. Open Folder with a space in the directory location (e.g. "C:\Users\USER\ex ample"
  2. Shift + Right-Click context menu -> "Open PowerShell Window Here"
  3. PowerShell opens and outputs an error:
Set-Location : A positional parameter cannot be found that accepts argument 'ample'.
At line:1 char:1
+ Set-Location -literalPath C:\Users\USER\ex ample
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Set-Location], ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.SetLocationCommand

Note that "Open in Terminal" option works in this example as it should.

Terminal Example Error:

  1. Open Folder with a space in the directory location (e.g. "C:\Users\USER[example"
  2. Right-Click context menu -> "Open in Terminal"
    3a. PowerShell opens and defaults to "C:>"
    3b. If PowerShell is given the command "cd "C:\Users\USER[example" or "Set-Location "C:\Users\USER[example""
Set-Location : The specified wildcard character pattern is not valid: [example
At line:1 char:1
+ Set-Location "C:\Users\USER\[example"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Set-Location], WildcardPatternException
    + FullyQualifiedErrorId : RuntimeException,Microsoft.PowerShell.Commands.SetLocationCommand

Note that "Open PowerShell Window Here" option works in this example as it should.

Expected behavior

Powershell Should open with the current working location as it's set specified location

Screenshots

Errors are written out in "Steps to Reproduce"

Additional context

For "Open PowerShell Here," my guess is that a command in the registry is broken due to not including quotation marks. I checked under "HKEY_CLASSES_ROOT\directory\background\shell\Powershell\command" and found the data value " powershell.exe -noexit -command Set-Location -literalPath "%V" ". from online sources I noticed that "%L" would be used, but I'm not sure what the difference is due to my inexpertise in this.

For the bracket wildcard error(?), I am curious if this could be a similar issue? I am out of my depth here.

Issue validation

  • [ X ] I checked for duplicate issues.
  • [ X ] I checked for already existing discussions.
  • [ X ] I checked for an already existing pull request addressing the issue.

I can't find anything related to this issue.

Edited for Better Formatting

@Compleur Compleur added the bug Something isn't working label Jan 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant