Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
10-23-2012, 03:46 AM #1
- Join Date
- Mar 2011
- Thanked 0 Times in 0 Posts
Modifying For loop variable batch file
Thing I want to do is to filter out specific video file extensions from a text file containing various video file names e.g filename.txt contents are
Red.mp4 Yellow.mp4 Blue.mp4 Orange.wmv Purple.wmv
::== @echo off setLocal EnableDelayedExpansion for /f "tokens=* delims= " %%a in ('type filename.txt ^|findstr ".mp4"') do ( set /a n+=1 echo >myfile!n!.txt set v!n!=x264 --crf 23 --level 3.1 --tune film --o "%%a" "%%a.mkv" ) set v pause ::==
1. How do I modify %%a to have its .mp4 string removed because when I apply "%%a.mkv" a file will be named *.mp4.mkv and I don't want that and .mp4 can be typed manually like --o "%%a.mp4" "%%a.mkv"
2. Provided that required txt files are already created how do I pass variables v1,v2,v3... to its respective text file I tried with
echo %v!n!% > >myfile!n!.txt