B
B
Brendan Castaneda2020-10-30 01:55:59
cmd/bat
Brendan Castaneda, 2020-10-30 01:55:59

How to set path in cmd variable?

How can I set the path of a variable?
I have a .bat file next to the Your_files folder, in this folder there is a file with the .mp4 extension.
I need to declare a variable so that it goes into the directory and finds any (all) .mp4 file (s) there - does not work. Issues: - does not work. Outputs: The file itself
set let1="Your_files\*.mp4"Your_files\*.mp4: Invalid argument
set let1=Your_files\ (*.mp4)Your_files\: No such file or directory

set let1="Your_files\*.mp4"
set let2="Result\%%~na.gif"
ffmpeg -i %let1% -filter_complex "fps=10,scale=-1:-1:flags=lanczos,split[o1][o2];[o1]palettegen[p];[o2]fifo[o3];[o3][p]paletteuse" %let2%
pause

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
wisgest, 2020-10-30
@ae_ph

I need to declare a variable so that it goes into the directory and finds any (all) .mp4 file(s) there

In this formulation, the question does not make sense.
How can I set the path of a variable?
What is it? Maybe "path in variable"?
set let1="Your_files\*.mp4"- does not work. Gives out:Your_files\*.mp4: Invalid argument

Well, it means that ffmpeg (I personally didn’t deal with it) does not understand wildcards in paths and does not perform group actions on files, and inserting a path through a variable will not help, use a file loop.
set let2="Result\%%~na.gif"
%%~nait doesn't make sense outside of loops...
If I understand what is required, try:
for %%a in ("Your_files\*.mp4") do (
  ffmpeg -i "%%~a" -filter_complex "fps=10,scale=-1:-1:flags=lanczos,split[o1][o2];[o1]palettegen[p];[o2]fifo[o3];[o3][p]paletteuse" "Result\%%~na.gif"
)
pause

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question