Pipeline bound parameters marked positional, should be considered to occupy their position - by Keith Hill MVP

Status : 

 


6
0
Sign in
to vote
ID 518294 Comments
Status Active Workarounds
Type Suggestion Repros 0
Opened 12/4/2009 3:29:53 PM
Access Restriction Public

Description

When a parameter is both pipeline bound and positional, it seems that PowerShell should remove that parameter from "positional" consideration.  For example, say I want to copy an item without pipeline binding.  Fortunately, positional parameters makes this easy e.g.:
 
copy-item foo.txt bar.txt
 
Because Path/LiteralPath are position 1 and Destination is at position 2.  However, once I pipeline bind I *have* to specify the Destination parameter name:
 
ls *.txt | copy-item -Destination {"$_.bak"}
 
That kind of sucks because there is no ambiguity in allowing this:
 
ls *.txt | copy-item {"$_.bak"}
Sign in to post a comment.