![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | getting arguments from pipe Why my program is not getting arguments from the pipe? When I invoke it like this: ls | ./myprog.exe The arguments passed to my program are empty. |
My System Specs![]() |
| | #2 (permalink) |
| | Re: getting arguments from pipe luntain wrote: Quote: > Why my program is not getting arguments from the pipe? > > When I invoke it like this: > ls | ./myprog.exe > > The arguments passed to my program are empty. understand .NET objects that are being passed to it via the pipeline. Marco -- Microsoft MVP - Windows PowerShell http://www.microsoft.com/mvp PowerGadgets MVP http://www.powergadgets.com/mvp Blog: http://marcoshaw.blogspot.com |
My System Specs![]() |
| | #3 (permalink) |
| | Re: getting arguments from pipe Marco, I'm not sure this is the case. This works fine on cmd.exe but returns error in PowerShell: PS > ipconfig /all | find /i "ip" FIND: Parameter format not correct I tried to "strip" the objects from get-childitem to force strings on the pipe, it doesn't wotk either PS > get-childitem | foreach {$_.name} | find /i "ps1" FIND: Parameter format not correct PS > get-childitem | out-string | find /i ".ps1" FIND: Parameter format not correct ----- Shay Levi $cript Fanatic http://scriptolog.blogspot.com Quote: > luntain wrote: > Quote: >> Why my program is not getting arguments from the pipe? >> >> When I invoke it like this: >> ls | ./myprog.exe >> The arguments passed to my program are empty. >> > not understand .NET objects that are being passed to it via the > pipeline. > > Marco > > PowerGadgets MVP > http://www.powergadgets.com/mvp > Blog: > http://marcoshaw.blogspot.com |
My System Specs![]() |
| | #4 (permalink) |
| | Re: getting arguments from pipe Shay Levi wrote: Quote: > Marco, > > I'm not sure this is the case. This works fine on cmd.exe but returns > error in PowerShell: > > PS > ipconfig /all | find /i "ip" > FIND: Parameter format not correct ipconfig /all | find /i `"ip`" OK, perhaps we need to understand what myprog.exe actually does and whether it works from DOS when doing something like a regular 'dir'. Marco |
My System Specs![]() |
| | #5 (permalink) |
| | Re: getting arguments from pipe Thanks, figured out that I needed to preserve the quote for find.exe, this will work too: ipconfig /all | find /i """ip""" ----- Shay Levi $cript Fanatic http://scriptolog.blogspot.com Quote: > Shay Levi wrote: > Quote: >> Marco, >> >> I'm not sure this is the case. This works fine on cmd.exe but returns >> error in PowerShell: >> >> PS > ipconfig /all | find /i "ip" >> FIND: Parameter format not correct > ipconfig /all | find /i `"ip`" > OK, perhaps we need to understand what myprog.exe actually does and > whether it works from DOS when doing something like a regular 'dir'. > > Marco > |
My System Specs![]() |
| | #6 (permalink) |
| | Re: getting arguments from pipe "luntain" <kamil.dworakowski@xxxxxx> wrote in message news:84bd09e6-f3ae-45f6-957c-ed0654f448c4@xxxxxx Quote: > Why my program is not getting arguments from the pipe? > > When I invoke it like this: > ls | ./myprog.exe > > The arguments passed to my program are empty. myprog.exe. Does your myprog.exe read from stdin? -- Keith |
My System Specs![]() |
| | #7 (permalink) |
| | Re: getting arguments from pipe "Marco Shaw [MVP]" Quote: Quote: >> ls | ./myprog.exe Quote: Quote: >> The arguments passed to my >> program are empty. Quote: > > myprog.exe is not a PowerShell cmdlet > or script, therefore it would not understand > .NET objects that are being passed to it > via the pipeline. > Log Parser 2.2, "understand .NET objects that are being passed to it via the pipeline". ![]() Either e-book or paperback book. Syngress Publishing - Microsoft Log Parser Toolkit http://www.syngress.com/catalog/?pid=3110 The below is one long line on the PowerShell command line. PS> ls | LogParser.exe "SELECT Field6 AS FileName FROM STDIN WHERE Field6 LIKE '%.ps1' " -i:tsv -headerRow ff -nSkipLines:8 -nFields:6-iSeparator:"spaces" -stats ffFileName ---------------- aTestScript1.ps1 PS> Mmm it seems Log Parser "understands"! Quote: > whether it works from DOS Logparser Forums http://forums.iis.net/default.aspx?GroupID=51 Skip through the forums and write one's data parsing once into a Log Parser text query file (that uses params), that can be called by almost any Windows language! Just another "command line shell" way! |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Using pipe in Powershell | PowerShell | |||
| Pipe response Yes to ALl | PowerShell | |||
| Pipe a pipe command to a file | VB Script | |||
| possibly pipe max? | PowerShell | |||
| Getting arguments from STDIN when command line arguments are missing | PowerShell | |||