Skip to content

Example code fail on pipeline #10478

@SweDaSe

Description

@SweDaSe

Type of issue

Code doesn't work

Feedback

First block of example code does not work.
begin block does not have access to value in $LiteralPath when piped to the function it's an empty string.

Get-ChildItem : Cannot bind argument to parameter 'LiteralPath' because it is an empty string.
At line:53 char:49
+             $Files = Get-ChildItem -LiteralPath $LiteralPath -File
+                                                 ~~~~~~~~~~~~

Still helpful with parameter sets, but code is misleading if trying to figure this topic out.

Page URL

https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_parameter_sets?view=powershell-5.1

Content source URL

https://github.com/MicrosoftDocs/PowerShell-Docs/blob/main/reference/5.1/Microsoft.PowerShell.Core/About/about_Parameter_Sets.md

Author

sdwheeler

Document Id

e0a2ba15-cff9-4560-35a9-cd4440ef1d84

Metadata

Metadata

Assignees

Labels

area-aboutArea - About_ topics

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions