call batch file from another passing parameters

后端 未结 3 488
渐次进展
渐次进展 2021-01-01 17:14

I have the following batch file that when run asks the user for input. This works fine.

@REM Sample batch file
SET PARAM1=\"\"
SET PARAM2=\"\"
SET /P PARAM1=         


        
3条回答
  •  情书的邮戳
    2021-01-01 17:36

    In main.cmd:

    set param1=%~1
    set param2=%~2
    echo %param1% - %param2%
    

    In caller.cmd:

    call main.cmd hello world
    

    Output:

    hello - world
    

    Reference for batch script parameters

提交回复
热议问题