View Single Post
Old 04-11-2012, 04:50 PM   #1
Rathji
Franchise Player
 
Rathji's Avatar
 
Join Date: Nov 2006
Location: Supporting Urban Sprawl
Exp:
Default Handbrake Script (Windows batch file question)

I couldn't find a Handbrake thread, but this is more about the rest of the command rather than the Hardbrake part.

I use this script to batch convert all the video files in a folder with Handbrake. This version I use just to reduce size on extremely large files, but I also tweak it to convert avi to mp4 as well.

This version works perfectly, dropping the converted file in the same location as the original:
Code:
FOR /F "tokens=*" %%F IN ('DIR /B /S *.MP4') DO "C:\Program Files (x86)\Handbrake\HandBrakeCLI" -i "%%F" -o "%%F".mp4 --preset="Normal"
This version, which I am trying to get to drop the converted file into a pre-designated folder, does not.

Code:
FOR /F "tokens=*" %%F IN ('DIR /B /S *.MP4') DO "C:\Program Files (x86)\Handbrake\HandBrakeCLI" -i "%%F" -o D:\Handbrake_Output\"%%F".mp4 --preset="Normal"
Obviously my syntax on "D:\Handbrake_Output\%%F".mp4 is incorrect, however everything I have tried has come up wrong. There are no spaces in the filenames I am testing on, but it should be able to handle them.

I also know there are executables that will do this job out there, but I want to keep this as a script I can run from any computer.
__________________
"Wake up, Luigi! The only time plumbers sleep on the job is when we're working by the hour."
Rathji is offline   Reply With Quote