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
Get-ChildItem -LiteralPath:'\\?\C:\Program Files' returns items from C:\ root #16166
Comments
Note that I would consider this bug (if it not only occurs for me for some reason) very serious. |
I see the same failure with 7.2.0-preview.9 |
Same here but I'm on 7.1.0 (Core) I also need to work around 260 limit across '000s of files with varying path length and filename lengths. If unicode path support worked correctly it would be massive result for my project. No doubt I'll hit this elsewhere, I'll keep looking for an alternative for now. There are features of 7.x I need so reverting to 5.1.x (mentioned above) is not an option. |
Still an serious issue - and I almost went to delete things under C:\ .... $PSVersionTable
Name Value
---- -----
PSVersion 7.2.1
PSEdition Core
GitCommitId 7.2.1
OS Microsoft Windows 10.0.19044
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0 |
Still an issue in 7.2.2 Name Value
---- -----
PSVersion 7.2.2
PSEdition Core
GitCommitId 7.2.2
OS Microsoft Windows 10.0.19044
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0 |
Problem Also seen at I am noticing a worse behaver As you can see from My screen Shot it doesn't only return to the Root but it returns to your PowerShell operation root For example even if you enter
it will still Return to your F: Driver Root and here is the .Net Version installed
The "\?" prefix
|
Still an issue in 7.2.5 |
Doesn't seem to be important enough to be taken care of... |
Yes, it seems to now work in Powershell 7.3.9 as expected. |
Prerequisites
Steps to reproduce
Might be related to #15872, but I fear this bug is more fundamental.
When I call
Get-ChildItem -LiteralPath:'\\?\C:\Program Files' in Powershell Core 7.1.4
it returns all directories and files located on 'C:\' regardless of what the current work directory is.
As soon as the specified path does not exist, I get the expected error.
E.g.
Get-ChildItem -LiteralPath:'\\?\C:\Program Filessssss'
will display error: 'Get-ChildItem: Cannot find path '\\?\C:\Program Filessssss' because it does not exist.
Get-ChildItem -LiteralPath:'\\?\C:\Program Files' works as expected in Windows Powershell 5.1.
Originally I detected this error with this:
Get-ChildItem -LiteralPath:'\\?\UNC\autlet\QA\TestResults\Artist'
where '\\autlet\QA\TestResults\Artist' is an existing folder on shared drive '\\autlet\QA'.
also for this case Get-ChildItem returns the files and folders from root of drive C:\.
Also here, if I specify a not existing folder, I get the expected error.
E.g.
Get-ChildItem -LiteralPath:'\\?\UNC\autlet\QA\TestResults\Artistttt'
will display error 'Get-ChildItem: Cannot find path '\\?\UNC\autlet\QA\TestResults\Artistttt' because it does not exist.
I'm aware, that this syntax ('\\?\UNC\...' resp. '\\?C:\...') is not documented in the Powershell documentation for Get-ChildItem (https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/get-childitem?view=powershell-7.1 - neither for Windows Powershell 5.1 nor for Powershell Core 7.x), but this solution can often be found in the internet when searching for solutions to 'long path' problems.
If this syntax should not be supported, then it should give an error in each case.
Expected behavior
Actual behavior
Error details
No response
Environment data
Visuals
#15872
The text was updated successfully, but these errors were encountered: