两个bat文件传递参数

1. 参数小于10个的时候:

   test1.bat 调test2.bat文件

    test1.bat文件:

   

   test2.bat文件

  

   执行test1.bat文件,运行结果如下图:

   

   test2.bat中输出test1.bat文件传的值。

2. 参数个数大于9的时候, 用shift /n命令。

  shift /0或者/1 左边第一个参数左移,后面给的参数依次不上。

  shift /n 第n个参数移除,右边的参数依次不上。

  test3.bat调用test4.bat文件,传递20个参数。

 

test4.bat文件:

 

运行test3.bat 执行结果:

猜你喜欢

转载自afra-liu.iteye.com/blog/1836213
今日推荐