Skip to content

Conversation

@kwkam
Copy link
Contributor

@kwkam kwkam commented Jul 30, 2018

PR Summary

Unescape non-literal path when -Name is not set.
This works around for New-Item treating -Path as literal path while
it can also be globbable. For example, assuming there is "[file]1"
in current directory, and tab completion suggests './`[file`]1'
for the -Path argument, but

New-Item -Path './`[file`]2'

will create a file named "`[file`]2" instead of "[file]2".

PR Checklist

Unescape non-literal path when -Name is not set.
This works around for New-Item treating -Path as literal path while
it can also be globbable. For example, assuming there is "[file]1"
in current directory, and tab completion suggests './`[file`]1'
for the -Path argument, but
> New-Item -Path './`[file`]2'
will create a file named "`[file`]2" instead of "[file]2".
@kwkam
Copy link
Contributor Author

kwkam commented Jul 30, 2018

Test result depends on WildcardPattern::Escape in #7407

@kwkam kwkam changed the title [Feature] Fix New-Item -Path with wildcard char Fix New-Item -Path with wildcard char Jul 31, 2018
kwkam added a commit to kwkam/PowerShell that referenced this pull request Aug 12, 2018
Describe "Remove-Item" -Tags "CI" {
$testpath = $TestDrive
$testfile = "testfile.txt"
$testfileSpName = "[testfile].txt"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Align variable definitions.

$testpath       = $TestDrive 
$testfile       = "testfile.txt" 
$testfile       = "testfile.txt" 
$testfileSpName = "[testfile].txt" 
$testfileSp     = "``[testfile``].txt" 
$testfilepath   = Join-Path -Path $testpath -ChildPath $testfile 
$testfilepath   = Join-Path -Path $testpath -ChildPath $testfile 
$testfilepathSp = Join-Path -Path $testpath -ChildPath $testfileSp 

@stale
Copy link

stale bot commented Sep 30, 2018

This PR has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed if no further activity occurs within 10 days.
Thank you for your contributions.
Community members are welcome to grab these works.

@stale stale bot added the Stale label Sep 30, 2018
@stale
Copy link

stale bot commented Oct 10, 2018

This PR has be automatically close because it is stale. If you wish to continue working on the PR, please first update the PR, then reopen it.
Thanks again for your contribution.
Community members are welcome to grab these works.

@stale stale bot closed this Oct 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants