私はMSバッチ(バット)のnoobieです。私はVLC経由でストリーミングをファイルに保存する必要があります。パラメータを使用してcmdのバッチでpidを取得するにはどうすればよいですか?
@echo off
"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" "http://STREAM" --sout=#transcode{vcodec=h264,vb=1400,scale=1,acodec=mpga,ab=192,channels=2,deinterlace}:file{dst="D:\SOMEFILE.mp4"}
しかし、私はN秒後に録画を停止する必要があります。 このスクリプトは私のためにgreateの作業します。私は通常の方法でPID、しかし、VLCのopenningを取得しています
@echo off
set "exe=C:\Program Files (x86)\VideoLAN\VLC\vlc.exe"
set "source=http://STREAM"
set "save-cmd=--sout=#transcode{vcodec=h264,vb=1400,scale=1,acodec=mpga,ab=192,channels=2,deinterlace}:file{dst="D:\SOMEFILE.mp4"}"
for /f "tokens=2 delims==; " %%a in ('wmic process call create '"%exe%" "%source%" %save-cmd%' ^| find "ProcessId"') do set PID=%%a
echo "%PID%"
timeout /t 120 /nobreak
taskkill /t /pid %PID%
:だから私は、私はいくつかの解決策を見つけた最良の方法は、このproccessのPIDを取得し、このために
timeout /t 120 /nobreak taskkill /t /pid %PID%
を実行することだと思います(何もしないでください)、私が実行したように
私はどのようにパラメータでプログラムを実行し、それのPIDを取得できますか? ありがとう!