-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
area-managementArea - Microsoft.PowerShell.Management moduleArea - Microsoft.PowerShell.Management module
Description
Example 8 (Test a path with whitespace as the value) says:
When a whitespace is or empty string in provided for the the -Path parameter, it returns false. The following example show whitespace and empty string.
I just tried this on my machine, and it seems to return true if you test a path that is just white-space:
Test-Path ' '
True
Test-Path ' ' -IsValid
True
Test-Path ''
Test-Path : Cannot bind argument to parameter 'Path' because it is an empty string.
At line:1 char:11
+ Test-Path ''
+ ~~
+ CategoryInfo : InvalidData: (:) [Test-Path], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.TestPathCommand
Test-Path '' -IsValid
Test-Path : Cannot bind argument to parameter 'Path' because it is an empty string.
At line:1 char:11
+ Test-Path '' -IsValid
+ ~~
+ CategoryInfo : InvalidData: (:) [Test-Path], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.TestPathCommand
$PSVersionTable
Name Value
---- -----
PSVersion 5.1.19018.1
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19018.1
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: 7cdf53fb-2b99-4d30-565a-dac575bfacc9
- Version Independent ID: 1ef1a1f1-1bb5-727e-edce-c4c15aa5a3d4
- Content: Test-Path (Microsoft.PowerShell.Management)
- Content Source: reference/5.1/Microsoft.PowerShell.Management/Test-Path.md
- Product: powershell
- Technology: powershell-cmdlets
- GitHub Login: @daxian-dbw
- Microsoft Alias: dongbow
Metadata
Metadata
Assignees
Labels
area-managementArea - Microsoft.PowerShell.Management moduleArea - Microsoft.PowerShell.Management module