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

No error changing to unquoted directory with space in name #4

Closed
thorstenkampe opened this issue Feb 10, 2018 · 2 comments
Closed

No error changing to unquoted directory with space in name #4

thorstenkampe opened this issue Feb 10, 2018 · 2 comments

Comments

@thorstenkampe
Copy link

This is possibly related to #3:

[thorsten] > cd directory with space
[thorsten] > pwd

Path
----
F:\cygwin\home\thorsten

Standard behaviour:

[thorsten] > cd directory with space
Set-Location : A positional parameter cannot be found that accepts argument 'with'.
At line:1 char:1
+ cd directory with space
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidArgument: (:) [Set-Location], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.SetLocationCommand```
@thorstenkampe thorstenkampe changed the title No error changing to unquoted directory No error changing to unquoted directory with space in name Feb 10, 2018
@nickcox
Copy link
Owner

nickcox commented Feb 11, 2018

Nice spot, thanks. I've fixed this for the time being although I'm not 100% happy with it as is.

The issue being that an unquoted path with a single space in it like program files is seen as the two argument variant of cd (Transpose-Location). (i.e. cd program files is translated to cd: program files which fails silently in the case that no replacement is found.

I've added a heuristic for now so that Transpose-Location isn't invoked in the case that either of the arguments begins with a directory separator but I'm open to better suggestions.

@nickcox
Copy link
Owner

nickcox commented Feb 11, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants