'Windows CLI, redirect command output into variable error "The system cannot find the file ffprobe."

FOR /F "tokens=*" %g IN (ffprobe -v error -select_streams v -show_entries stream=width -of csv=p=0:s=x 1.mp4) do SET width=%g

When executing this command, I receive the error

The system cannot find the file ffprobe.

However, when I run the command ffprobe -v error -select_streams v -show_entries stream=width -of csv=p=0:s=x 1.mp4, ffprobe runs just fine and outputs the width of 1.mp4



Solution 1:[1]

You are asking for to read files, not execute a command. Depending on the quote character, for can parse a string or run a command. Run for /? for the details.

for /F "tokens=*" %g in ('ping localhost^|find "Reply"') do @echo.%g

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Anders