1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved Batch Script "For" command

Discussion in 'Software Development' started by Damonc, Jul 16, 2017 at 8:57 PM.

Advertisement
  1. Damonc

    Damonc Thread Starter

    Joined:
    May 9, 2001
    Messages:
    618
    Hi,

    Hopefully something simple that I'm missing here. I've got the below command to find and convert MOV files to MP4 files.. The command currently puts the converted file into the current working directory, however I'd like it to put the converted file in the same directory that the original MOV file was in..

    Code:
    FOR /R C:\Media %i in (*.mov) do c:\encoder\ffmpeg.exe -i "%i" -c:v libx264 "%~ni.mp4"
    Cheers.
     
  2. Damonc

    Damonc Thread Starter

    Joined:
    May 9, 2001
    Messages:
    618
    got it:
    Code:
    FOR /R C:\Media %i in (*.mov) do c:\encoder\ffmpeg.exe -i "%i" -c:v libx264 "%~pi%~ni.mp4"
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...

Short URL to this thread: https://techguy.org/1193189