1

I am trying to invoke a command-line .exe tool (x264 to convert some videos) and print its output in PowerShell host.

There are a lot of parameters that need to be passed to the x264. So far I couldn't run it with the Invoke-Item cmdlet so I tried

[diagnostics.process]::start($com, $args).WaitForExit()

This works fine but it opens the old cmd window to show the output. Just out of curiosity I was wondering how can I show the output in the host.

2 Answers 2

2

I might be completely off, no PowerShell guru, but can't you just run the following?

$args = @("list", "of", "args", "here")
& x264.exe $args
Sign up to request clarification or add additional context in comments.

Comments

0

When the cmd window opens, does it show the output? If so, maybe this can help.

Start-Process c:\x264.exe -ArgumentList $args -Wait -NoNewWindow

3 Comments

It outputs the result but not in the Host. (I removed the -NoNewWindow parameter to check) Also, is it possible to use this output?
I downloaded x264 (core:114 r1913 5fd3dce) and executed it, it runs in the same window. what happens when you assign the command to a variable? The variable contains the output when the program finished?
No, if I use a variable, it'll just print "True". I think that's the output for "0" (successfull exit).

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.