Home > Software design >  Run console app(MediaInfo.exe), and put output to variable
Run console app(MediaInfo.exe), and put output to variable

Time:05-28

CMD:

MediaInfo.exe -h

Output - help information

Ps:

$res = MediaInfo.exe -h

$res - help information (ok)

CMD:

MediaInfo.exe --Output=Audio;%StreamKindPos%^|%Language/String%^|%Title% video.mkv

Output - audio information

ps:

$res = MediaInfo.exe '--Output=Audio;%StreamKindPos%^|%Language/String%^|%Title% video.mkv'

$res - Usage: "MediaInfo [-Options...] FileName1 [Filename2...]" "MediaInfo --Help" for displaying more information (wrong output)

How to launch a console application correctly from powershell? Maybe I need to escape something in the parameters?

CodePudding user response:

Options and file path is a two parameters, and you should pass them as two parameters:

$res = MediaInfo.exe "--Output=Audio;%StreamKindPos%^|%Language/String%^|%Title%" "video.mkv"
  • Related