@echo off :: NAMED PARAMETERS generic :: for every input parameter break it into two parts :: where 1st part is the new variable name :: and 2nd part is variable value :: example input would be : :: named.bat aud-faac bit-500 avs-"c:\folder\template.avs" inp-"d:\movies\file.avi" :: put input parameters into some temporary variables: set par1=%1 2> nul set par2=%2 2> nul set par3=%3 2> nul set par4=%4 2> nul set par5=%5 2> nul set par6=%6 2> nul set par7=%7 2> nul set par8=%8 2> nul set par9=%9 2> nul :: use 1st part (1st three letters) as variable name and 2nd (all letter from 4 to the end) as variable value: set %par1:~0,3%=%par1:~4% 2> nul set %par2:~0,3%=%par2:~4% 2> nul set %par3:~0,3%=%par3:~4% 2> nul set %par4:~0,3%=%par4:~4% 2> nul set %par5:~0,3%=%par5:~4% 2> nul set %par6:~0,3%=%par6:~4% 2> nul set %par7:~0,3%=%par7:~4% 2> nul set %par8:~0,3%=%par8:~4% 2> nul set %par9:~0,3%=%par9:~4% 2> nul :: end of NAMED PARAMETERS generic :: here you would check if proper variable names are given and proper parameters as well maybe: ::------------------------------------------------------- :: possible parameters: :: inp - input avi file :: avs - avisynth template :: bit - bitrate :: met - encoding method subrutine :: aud - audio encoding method (faac or itnues) ::------------------------------------------------------- :: minimum required are inp and avs, bitrate defaults to 1000 if not defined, audio defaults to faac if not defined if .%avs%==. ( echo user error - path to avisynth template not defined - aborting goto :EOF ) if .%inp%==. ( echo user error - path to input avi file not defined - aborting goto :EOF ) :: else echo --------------------- echo ...............avs-%avs% echo break avs into parts CALL :SplitPath %avs% avsdrive avspath avsname avsext echo avisynth template path info: ECHO avsdrive: %avsdrive% ECHO avspath: %avspath% ECHO avsname: %avsname% ECHO avsext: %avsext% echo --------------------- echo ...............inp-%inp% echo break inp into parts CALL :SplitPath %inp% inpdrive inppath inpname inpext echo avi file path info: ECHO inpdrive: %inpdrive% ECHO inppath: %inppath% ECHO inpname: %inpname% ECHO inpext: %inpext% echo ...............other if .%bit%==. ( set bit=1000 echo bit undefined, defaults to 1000 ) else ( echo bit %bit% ) if .%aud%==. ( set aud=faac echo aud undefined, defaults to faac ) else ( echo aud %aud% ) if .%met%==. ( set met=1 echo met undefined, defaults to 1 ) else ( echo met %met% ) GOTO :eof :SplitPath SET %2=%~d1 SET %3=%~p1 SET %4=%~n1 SET %5=%~x1 GOTO :eof