Jump to content

Hello, I'm trying to automate the creation of script files through this batch.

 

I can't seem to get it working:

for /f %%z in ('type %1') do (@[member=Echo] setmtmode(5,6)> "Y:\Scripts\%%~nz.avs"@[member=Echo] filenameTitle="%%~nz">> "Y:\Scripts\%%~nz.avs"@[member=Echo] title=ffvideosource(filenameTitle)>> "Y:\Scripts\%%~nz.avs"@[member=Echo] titlea=ffaudiosource(filenameTitle)>> "Y:\Scripts\%%~nz.avs"@[member=Echo] audiodub(title,titlea)>> "Y:\Scripts\%%~nz.avs" )

The file I drop contains paths for each line enclosed in quotes.

 

edit: I think the issue is that the paths are being used as filenames with invalid \ characters. Maybe there's a way to just take what is after the last \. I tried with "delims=\"

Link to comment
https://linustechtips.com/topic/325740-batch-loop-paths/
Share on other sites

Link to post
Share on other sites

Got it working. I post solution:

for /f %%z in ('type %1') do (@[member=Echo] setmtmode^(5,6^)> "Y:\Scripts\%%~nz.avs"@[member=Echo] filenameTitle^="%%~z">> "Y:\Scripts\%%~nz.avs"@[member=Echo] title^=ffvideosource^(filenameTitle^)>> "Y:\Scripts\%%~nz.avs"@[member=Echo] titlea^=ffaudiosource^(filenameTitle^)>> "Y:\Scripts\%%~nz.avs"@[member=Echo] audiodub^(title,titlea^)>> "Y:\Scripts\%%~nz.avs" )

Although I still have issues with paths with spaces

 

Updated and working:

for /f "usebackq delims=" %%z in ("%~1") do (@[member=Echo] setmtmode^(5,6^)> "Y:\Scripts\%%~nz.avs"@[member=Echo] filenameTitle^="%%~z">> "Y:\Scripts\%%~nz.avs"@[member=Echo] title^=ffvideosource^(filenameTitle^)>> "Y:\Scripts\%%~nz.avs"@[member=Echo] titlea^=ffaudiosource^(filenameTitle^)>> "Y:\Scripts\%%~nz.avs"@[member=Echo] audiodub^(title,titlea^)>> "Y:\Scripts\%%~nz.avs" )
Link to comment
https://linustechtips.com/topic/325740-batch-loop-paths/#findComment-4424371
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×