Using a bat file how to select file from directory for processing if it's of certain type
<p>I'm using the command line interface version of MediaInfo to extract several parameters (to keep the code brief I  only show format and duration below) from several hundred small video tutorials to process them for other uses.</p>

<p>I use a .bat file that gathers the parameters, pipes them to a txt file and then opens the file in Notepad:</p>

<pre><code>f:\path\mediainfo.exe "--Inform=Video;%%Format%%\r\n%%Duration/String%%" "tutorial.mp4" &gt; out.txt

sleep 1

start out.txt
</code></pre>

<p>As it stands now I have to cut and paste the actual video name into the batch file (file name is "tutorial.mp4" in code above) because I don't know how to programmatically get that parameter into the mediainfo command.</p>

<p>So, my question is, since the video files will always be either .avi or .mp4, is there a way to add some code to the bat file to look for a file in the directory the bat file is in and if it's either of those two types insert the file name into the first line as I have it now?  There will only ever be one single video file in the sub directory and it will be either a .avi or a .mp4.  It's remotely possible that there might be other file types in the subdirectory so for this reason I can't say "pick the ONLY file in the subdirectory and insert it into the bat file".</p>

<p>I'm wondering if something along this line added to the top of the file:</p>

<pre><code>IF EXIST *.avi || *.mp4
</code></pre>

<p>But I don't know if I can use the OR command like that and I don't know how to assign the filename to a variable and how to use that variable in the mediainfo.exe line.....</p>