Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8703101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:48:11+00:00 2026-06-13T02:48:11+00:00

OK so im trying to do batch video processing and i’d like to get

  • 0

OK so im trying to do batch video processing and i’d like to get it condensed down to a single batch file rather than 5 but im not able to pass variables to internal functions the same as i would pass them to an external .bat file.

heres my “all in one” version

mkdir new

mkdir new\fonts

forfiles /M *.mkv /C "cmd /c call :mkvextract @file @fname" >> log.txt 2>&1

forfiles /M *.mkv /C "cmd /c call :mkvmerge @file" >> merge.txt 2>&1

forfiles /M *.mkv /C "cmd /c call :makeavs @file @fname" >> log.txt 2>&1

forfiles /M *.mkv /C "cmd /c call :getfonts @file @fname" >> fonts.txt 2>&1

forfiles /M *.ttf /C "cmd /c call :movefonts @file" >> fonts.txt 2>&1

forfiles /M *.TTF /C "cmd /c call :movefonts @file" >> fonts.txt 2>&1

forfiles /M *.otf /C "cmd /c call :movefonts @file" >> fonts.txt 2>&1

forfiles /M *.OTF /C "cmd /c call :movefonts @file" >> fonts.txt 2>&1

:mkvextract

"C:\Program Files (x86)\MKVToolNix\mkvextract.exe" --ui-language en tracks "%~1" 2:"%CD%\new\%~2_track3_eng.ass"

goto :EOF

:mkvmerge

set mkvorig=%CD%\%~1
set mkvorig=%mkvorig:\=\\%

set mkvnew=%CD%\new\%~1
set mkvnew=%mkvnew:\=\\%

"C:\Program Files (x86)\MKVToolNix\mkvmerge.exe" -o "%mkvnew%"  "--language" "0:jpn" "--default-track" "0:yes" "--forced-track" "0:no" "--display-dimensions" "0:1920x1080" "--language" "1:jpn" "--default-track" "1:yes" "--forced-track" "1:no" "-a" "1" "-d" "0" "--no-attachments" "-S" "-T" "--no-global-tags" "--no-chapters" "(" "%mkvorig%" ")" "--track-order" "0:0,0:1"

goto :EOF

:makeavs

echo Directshowsource("new\%~1") >"new\%~2.avs"
echo textsub("new\%~2_track3_eng.ass") >>"new\%~2.avs"

goto :EOF

:getfonts

"C:\Program Files (x86)\MKVToolNix\mkvextract.exe" attachments "%~1" 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

goto :EOF


:movefonts

move %~1 new\fonts

goto :EOF

The “five .bat files” version is as follows:

mkdir new

mkdir new\fonts

forfiles /M *.mkv /C "cmd /c mkvextract.bat @file @fname" >> log.txt 2>&1

forfiles /M *.mkv /C "cmd /c mkvmerge.bat @file" >> merge.txt 2>&1

forfiles /M *.mkv /C "cmd /c makeavs.bat @file @fname" >> log.txt 2>&1

forfiles /M *.mkv /C "cmd /c getfonts.bat @file @fname" >> fonts.txt 2>&1

forfiles /M *.ttf /C "cmd /c movefonts.bat @file" >> fonts.txt 2>&1

forfiles /M *.TTF /C "cmd /c movefonts.bat @file" >> fonts.txt 2>&1

forfiles /M *.otf /C "cmd /c movefonts.bat @file" >> fonts.txt 2>&1

forfiles /M *.OTF /C "cmd /c movefonts.bat @file" >> fonts.txt 2>&1

im not quite sure how if im doing function calls correctly either but it looks right base don what i found here: http://batcheero.blogspot.com/2007/07/function-call-in-batch.html

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T02:48:12+00:00Added an answer on June 13, 2026 at 2:48 am

    The command(s) executed by forfiles are within a brand new CMD.EXE session. They are no longer in your master batch context, so you cannot call a subroutine within your master batch script.

    You could restructure your master script to call itself and and pass the name of the routine as an argument. If the label exists your script can then GOTO that label.

    Your first script was also missing EXIT /B or GOTO :EOF before the first subroutine.

    You do not need to make intermediate directories. You can directly make new\fonts and new will be created if it does not yet exist.

    @echo off
    
    :: If first argument is a valid label then GOTO that label
    if "%~1" neq "" findstr /bc:":%~1" "%~f0" >nul && (
      shift /1
      goto %~1
    )
    
    ::Main program
    if not exist new\fonts mkdir new\fonts
    forfiles /M *.mkv /C "cmd /c "%~f0" mkvextract @file @fname" >> log.txt 2>&1
    forfiles /M *.mkv /C "cmd /c "%~f0" mkvmerge @file" >> merge.txt 2>&1
    forfiles /M *.mkv /C "cmd /c "%~f0" makeavs @file @fname" >> log.txt 2>&1
    forfiles /M *.mkv /C "cmd /c "%~f0" getfonts @file @fname" >> fonts.txt 2>&1
    forfiles /M *.ttf /C "cmd /c "%~f0" movefonts @file" >> fonts.txt 2>&1
    forfiles /M *.TTF /C "cmd /c "%~f0" movefonts @file" >> fonts.txt 2>&1
    forfiles /M *.otf /C "cmd /c "%~f0" movefonts @file" >> fonts.txt 2>&1
    forfiles /M *.OTF /C "cmd /c "%~f0" movefonts @file" >> fonts.txt 2>&1
    exit /b
    
    :mkvextract
    "C:\Program Files (x86)\MKVToolNix\mkvextract.exe" --ui-language en tracks "%~1" 2:"%CD%\new\%~2_track3_eng.ass"
    exit /b
    
    :mkvmerge
    set mkvorig=%CD%\%~1
    set mkvorig=%mkvorig:\=\\%
    set mkvnew=%CD%\new\%~1
    set mkvnew=%mkvnew:\=\\%
    "C:\Program Files (x86)\MKVToolNix\mkvmerge.exe" -o "%mkvnew%"  "--language" "0:jpn" "--default-track" "0:yes" "--forced-track" "0:no" "--display-dimensions" "0:1920x1080" "--language" "1:jpn" "--default-track" "1:yes" "--forced-track" "1:no" "-a" "1" "-d" "0" "--no-attachments" "-S" "-T" "--no-global-tags" "--no-chapters" "(" "%mkvorig%" ")" "--track-order" "0:0,0:1"
    exit /b
    
    :makeavs
    echo Directshowsource("new\%~1") >"new\%~2.avs"
    echo textsub("new\%~2_track3_eng.ass") >>"new\%~2.avs"
    exit /b
    
    :getfonts
    "C:\Program Files (x86)\MKVToolNix\mkvextract.exe" attachments "%~1" 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
    exit /b
    
    :movefonts
    move %~1 new\fonts
    exit /b
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to execute a batch file in C#, but I'm not getting any
I am trying to call a batch file from an application, but I want
Trying to set some basic validation in a batch file but keep getting a
I am trying run a batch file from my java codes, but unfortunately I
I am trying to create a batch file to parse a directory Z:\ (not
I am trying to run a batch file automatically during a build from a
I'm trying to make a batch file through Notepad to essentially automate a process
I am trying to batch rename old log files, but the script only works
trying to run a simple batch file in windows 2008 task scheduler call cleanup.bat
I am trying to write a small batch file for a task I do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.