Board logo

标题: [问题求助] PowerShell怎样获取 ffprobe 的输出 [打印本页]

作者: newswan    时间: 3 天前 22:10     标题: PowerShell怎样获取 ffprobe 的输出

  1. $str = ffprobe.exe -hide_banner .\AVTA0877.mp3
复制代码
不能获取命令输出,
  1. $str = ffprobe.exe -hide_banner .\AVTA0877.mp3 2>&1
复制代码
会有错误提示,怎么将 & 转义,或者用其他方式调用 ffprobe

原因是 ffprobe 的输出到 错误输出 , powershell 怎么捕获错误输出的问题
作者: newswan    时间: 3 天前 22:23

  1. $str = cmd /c "ffprobe.exe -hide_banner .\AVTA0877.mp3 2>&1"
复制代码
可行
  1. Start-Process -FilePath "C:\Windows\ffprobe.exe" -ArgumentList " -hide_banner .\AVTA0877.mp3" -NoNewWindow -RedirectStandardError "output-error.txt"
复制代码
找到这两种方法,还有其他方法吗?
作者: Five66    时间: 前天 00:57

ps的流(包括管道)跟常规的不一样 , 外部程序使用的是常规的流
试试
  1. $str = ffprobe.exe -hide_banner .\AVTA0877.mp3 2>&1
  2. $str|foreach{$_.ToString()}
复制代码





欢迎光临 批处理之家 (http://bathome.net./) Powered by Discuz! 7.2