:: A trivial example showing how to pass values :: from one batch file to another :: In practice function.cmd could be a very complex script :: with lots of variables. :: The only variables that are visible to the main batch file :: are those returned in the last line of function.cmd :: This way of working means you don't have to worry about :: accidentally using the same variable name in both scripts. :: Thus removing a common source of bugs. ::--------------------start main.cmd-------------------:: @echo off&SETLOCAL SET v_first_bit=This text won`t change CALL function 10 first echo %v_description% - %v_number% CALL function 15 second echo %v_description% - %v_number% CALL function 25 third echo %v_description% - %v_number% CALL function 48 fourth echo %v_description% - %v_number% echo Original Variable-- %v_first_bit% ::---------------------end main.cmd--------------------:: ::--------------------start function.cmd-------------------:: @echo off&SETLOCAL SET /a v_first_bit=%1 + 25 SET v_descr=[%2] SET /a v_second_bit=%v_first_bit% - 10 SET /a v_num=%v_second_bit% + 100 ENDLOCAL& SET v_number=%v_num%&SET v_description=%v_descr% ::---------------------end function.cmd--------------------::