PowerShell's pipe adds linefeed

前端 未结 5 1289
醉梦人生
醉梦人生 2021-02-07 05:45

I\'m trying to pipe a string into a program\'s STDIN without any trailing linefeeds (unless that string itself actually ends in a linefeed). I tried googling around, bu

5条回答
  •  抹茶落季
    2021-02-07 06:33

    Do it a simple way create a cmd process and execute it

    $cmdArgs = @('/c','something.exe','arg1', .. , 'arg2' , $anotherArg , '<', '$somefile.txt' )
    &'cmd.exe' $cmdArgs
    

    Worked perfect for piping information into stdin that I wanted,

提交回复
热议问题