|
Answer» I thout about seperating code between files and use them as functions. I had many errors until I realized that the Output of this Funcs must be only the 'ECHO ...' that I need. In these file there must be ECHO OFF in its 1st line, otherwise each line code become an Output. Here is a little example. even recursive: Let's have file Named Func.CMD We CALL it from Command-Line with a parameter:
Code: [Select]CALL Func.CMD 1The code in Func.CMD:
Code: [Select]ECHO OFF SET /A X = %1 + 1 IF %X% LSS 10 FOR /F "DELIMS=" %%i IN ('CALL Func.CMD %X%') DO SET /A X = %%i ECHO %X%
It LOOKS so: C:\>CALL Func.CMD 1 10
I HOPE SOMEONE can enjoy it YossiThis can be useful, but its hard to pass things out.
Something LIKE this might work.
Code: [Select]Setlocal enabledelayedexpansion Set param_num=0 For %%a in ('call func.bat %param1%') do ( Set param_!param_num!=%%a Set /a param_num+=1 )
|