You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
BUG: Get-Content WRONG ERROR MESSAGE when wildcards yield no files #6954
Get-Content : An object at the specified path C:\NonExistentWildcard*.txt does not exist, or has been filtered by the -Include or -Exclude parameter.
Actual behavior
Three different errors:
Get-Content : An object at the specified path C:\NonExistentWildcard*.txt does not exist, or has been filtered by the -Include or -Exclude parameter.
Get-Content : A parameter cannot be found that matches parameter name 'Raw'.
Get-Content : A parameter cannot be found that matches parameter name 'Delimiter'.
Environment data
>$PSVersionTable
Name Value
---------
PSVersion 6.0.2
PSEdition Core
GitCommitId v6.0.2
OS Microsoft Windows 10.0.17134
Platform Win32NT
PSCompatibleVersions {1.0,2.0,3.0,4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
$vbppath = 'C:\W10Build-Nexus\Nexus\NexUSVB6\NEXUS\Load Configuration File\CIUSConfigFileIO.vbp'
$Content = (Get-Content -LiteralPath $vbppath -Raw)
A parameter cannot be found that matches parameter name 'Raw'.
PSVersion 5.1.16299.251 what fix is there for this
Activity
Jaykul commentedon May 29, 2018
Just don't ask me how long I spent running builds with variations of this command before I finally figured out the problem.
MaximoTrinidad commentedon May 29, 2018
It can be repo in Preview-6:
suprak commentedon Oct 5, 2018
This is also the case if the path has square brackets.
For example,
The workaround is to use
LiteralPath.mrp100461 commentedon Apr 15, 2020
$vbppath = 'C:\W10Build-Nexus\Nexus\NexUSVB6\NEXUS\Load Configuration File\CIUSConfigFileIO.vbp'
$Content = (Get-Content -LiteralPath $vbppath -Raw)
A parameter cannot be found that matches parameter name 'Raw'.
PSVersion 5.1.16299.251 what fix is there for this
suprak commentedon Apr 15, 2020
Mark Pearson (@mrp100461)
I can't repro missing
-Rawswitch,mrp100461 commentedon Apr 17, 2020
@surpack It need spaces in the path