-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Fix New-Item -Path with wildcard char #7404
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
Conversation
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".
|
Test result depends on WildcardPattern::Escape in #7407 |
test/powershell/Modules/Microsoft.PowerShell.Management/New-Item.Tests.ps1
Outdated
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Management/New-Item.Tests.ps1
Outdated
Show resolved
Hide resolved
| Describe "Remove-Item" -Tags "CI" { | ||
| $testpath = $TestDrive | ||
| $testfile = "testfile.txt" | ||
| $testfileSpName = "[testfile].txt" |
There was a problem hiding this comment.
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
|
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. |
|
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. |
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
will create a file named
"`[file`]2"instead of"[file]2".PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:to the beginning of the title and remove the prefix when the PR is ready.[feature]if the change is significant or affects feature tests