{"id":17816,"date":"2008-12-24T07:29:14","date_gmt":"2008-12-24T15:29:14","guid":{"rendered":"http:\/\/devblogs.microsoft.com\/powershell\/?p=17816"},"modified":"2019-06-07T07:31:12","modified_gmt":"2019-06-07T15:31:12","slug":"powershell-v2-pipelining-in-73-make-that-53-characters","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/powershell\/powershell-v2-pipelining-in-73-make-that-53-characters\/","title":{"rendered":"PowerShell v2 Pipelining in 73 (make that 53) Characters"},"content":{"rendered":"<p><P>I started using Twitter and saw a request from Thomas Lee for help about pipelining in CTP3.&nbsp; The thing about Twitter is that the messages have to be tiny so I wasn\u2019t sure I could answer using it.&nbsp; It turns out I can solve this problem AND give a usage example in 73 characters.&nbsp; Here goes:<\/P>\n<P><FONT color=#0000ff size=2 face=Consolas>PS&gt; function t{param([Parameter(ValueFromPipeline=1)]$t);process{$t}};1..10|t <BR>1 <BR>2 <BR>3 <BR>4 <BR>5 <BR>6 <BR>7 <BR>8 <BR>9 <BR>10<\/FONT><\/P>\n<P>Now if you put it into a file (which is actually what Thomas asked for), then it is only 53 characters:<\/P>\n<P><FONT color=#0000ff size=2 face=Consolas>PS&gt; cat t.ps1 <BR>param([Parameter(ValueFromPipeline=1)]$t);process{$t} <BR>PS&gt; cat t.ps1 |Measure -Character <\/FONT><\/P>\n<P><FONT color=#0000ff size=2 face=Consolas>Lines&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Words&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Characters Property <BR>&#8212;&#8211;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8212;&#8211;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8212;&#8212;&#8212;- &#8212;&#8212;&#8211; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 53 <\/FONT><\/P>\n<P><FONT color=#0000ff size=2 face=Consolas>PS&gt; 1..10 |.\\t.ps1 <BR>1 <BR>2 <BR>3 <BR>4 <BR>5 <BR>6 <BR>7 <BR>8 <BR>9 <BR>10<\/FONT><\/P>\n<P>Enjoy!<\/P>\n<P>Jeffrey Snover [MSFT] <BR>Windows Management Partner Architect <BR>Visit the Windows PowerShell Team blog at:&nbsp;&nbsp;&nbsp; <A href=\"http:\/\/blogs.msdn.com\/PowerShell\" mce_href=\"http:\/\/blogs.msdn.com\/PowerShell\">http:\/\/blogs.msdn.com\/PowerShell<\/A> <BR>Visit the Windows PowerShell ScriptCenter at:&nbsp; <A href=\"http:\/\/www.microsoft.com\/technet\/scriptcenter\/hubs\/msh.mspx\" mce_href=\"http:\/\/www.microsoft.com\/technet\/scriptcenter\/hubs\/msh.mspx\">http:\/\/www.microsoft.com\/technet\/scriptcenter\/hubs\/msh.mspx<\/A><\/P><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I started using Twitter and saw a request from Thomas Lee for help about pipelining in CTP3.&nbsp; The thing about Twitter is that the messages have to be tiny so I wasn\u2019t sure I could answer using it.&nbsp; It turns out I can solve this problem AND give a usage example in 73 characters.&nbsp; Here [&hellip;]<\/p>\n","protected":false},"author":600,"featured_media":13641,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[97,137,210],"class_list":["post-17816","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell","tag-advanced-functions","tag-ctp3","tag-jeffrey-snover"],"acf":[],"blog_post_summary":"<p>I started using Twitter and saw a request from Thomas Lee for help about pipelining in CTP3.&nbsp; The thing about Twitter is that the messages have to be tiny so I wasn\u2019t sure I could answer using it.&nbsp; It turns out I can solve this problem AND give a usage example in 73 characters.&nbsp; Here [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/17816","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/users\/600"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/comments?post=17816"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/17816\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media\/13641"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media?parent=17816"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/categories?post=17816"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/tags?post=17816"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}