Run Batch File on All Files in a Folder

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
johnbil
Posts: 11
Joined: 06 Jul 2013 09:01

Run Batch File on All Files in a Folder

#1 Post by johnbil » 06 Jul 2013 09:10

I have a batch file that adjusts the level in the audio portion of a a video file. It has commands which use the '%1' variable in its scripting.

How do I get the batch file to automatically perform its commands against all files in a specified folder rather than execute the batch file against each individual file? Would it be necessary to create a second batch file to execute the first one on each file in the folder?

Any help would be appreciated.

John

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: Run Batch File on All Files in a Folder

#2 Post by Squashman » 06 Jul 2013 09:53

Code: Select all

@echo off
PUSHD "C:\path to video folder\"
FOR %%G IN (*.*) DO "C:\Path\CONVERTER.exe" "%%~G"

johnbil
Posts: 11
Joined: 06 Jul 2013 09:01

Re: Run Batch File on All Files in a Folder

#3 Post by johnbil » 07 Jul 2013 11:22

Thanks, Squashman. Works perfectly.

Post Reply