If a path specified by -LiteralPath does not exist (or is not valid, i.e.
contains forbidden characters) then Get-Item should emit an error.
Currently this does not happen if a path is defined as a wildcard.
The change #4866 fixed this issue for Remove-Item.
The same or similar should be done for Get-Item.
Example:
Given items z.* and [z] do not exist
EDIT: Given item [z] does not exist. As for z.*, it is always "invalid" for LiteralPath.
Get-Item -LiteralPath z.*
Get-Item -LiteralPath [z]
Expected result:
Get-Item emit errors about not found items.
In fact, an error for z.* may even be different, namely "Illegal characters
in the path" because * or ? are illegal for -LiteralPath and FileSystem.
Actual result:
The above commands silently return nothing.
If a path specified by
-LiteralPathdoes not exist (or is not valid, i.e.contains forbidden characters) then
Get-Itemshould emit an error.Currently this does not happen if a path is defined as a wildcard.
The change #4866 fixed this issue for
Remove-Item.The same or similar should be done for
Get-Item.Example:
Given itemsz.*and[z]do not existEDIT: Given item
[z]does not exist. As forz.*, it is always "invalid" forLiteralPath.Expected result:
Get-Itememit errors about not found items.In fact, an error for
z.*may even be different, namely "Illegal charactersin the path" because
*or?are illegal for-LiteralPathand FileSystem.Actual result:
The above commands silently return nothing.