bat批处理脚本--call:一个调用外部批处理程序的指令

项目中用phpcs和进行代码兼容性检查,输出结果到文档,由于扫描整个项目内存会溢出,所以分模块扫描的。单个模块扫描命令如下:

call phpcs --standard=PHPCompatibility --report-file=[输出文档地址] [扫描文件或文件夹]

多个模块的话,想着创建一个bat程序,点击运行就可以将所有模块扫描并且输出文档到指定目录,bat文件内容如下:

phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule1 D:\www\modules\mudule1
phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule2 D:\www\modules\mudule2
phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule3 D:\www\modules\mudule3
phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule4 D:\www\modules\mudule4
phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule5 D:\www\modules\mudule5
phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule6 D:\www\modules\mudule6
phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule7 D:\www\modules\mudule7
phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule8 D:\www\modules\mudule8
phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule9 D:\www\modules\mudule9
phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule10 D:\www\modules\mudule10
phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule11 D:\www\modules\mudule11
phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule12 D:\www\modules\mudule12
phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule13 D:\www\modules\mudule13
phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule14 D:\www\modules\mudule14
phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule15 D:\www\modules\mudule15
phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule16 D:\www\modules\mudule16
phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule17 D:\www\modules\mudule17
phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule18 D:\www\modules\mudule18
phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule19 D:\www\modules\mudule19
phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule20 D:\www\modules\mudule20
phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule21 D:\www\modules\mudule21
phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule22 D:\www\modules\mudule22
phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule23 D:\www\modules\mudule23
phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule24 D:\www\modules\mudule24
phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule25 D:\www\modules\mudule25
phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule26 D:\www\modules\mudule26
phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule27 D:\www\modules\mudule27
phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule28 D:\www\modules\mudule28
phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule29 D:\www\modules\mudule29
phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule30 D:\www\modules\mudule30
phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule31 D:\www\modules\mudule31
phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule32 D:\www\modules\mudule32
phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule33 D:\www\modules\mudule33
phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule34 D:\www\modules\mudule34
phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule35 D:\www\modules\mudule35
phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule36 D:\www\modules\mudule36

运行bat,只执行了第一行。

经过在网上的查找,才知道在bat里调用外部命令,需要用call,代码修改如下:

call phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule1 D:\www\modules\mudule1
call phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule2 D:\www\modules\mudule2
call phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule3 D:\www\modules\mudule3
call phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule4 D:\www\modules\mudule4
call phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule5 D:\www\modules\mudule5
call phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule6 D:\www\modules\mudule6
call phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule7 D:\www\modules\mudule7
call phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule8 D:\www\modules\mudule8
call phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule9 D:\www\modules\mudule9
call phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule10 D:\www\modules\mudule10
call phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule11 D:\www\modules\mudule11
call phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule12 D:\www\modules\mudule12
call phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule13 D:\www\modules\mudule13
call phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule14 D:\www\modules\mudule14
call phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule15 D:\www\modules\mudule15
call phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule16 D:\www\modules\mudule16
call phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule17 D:\www\modules\mudule17
call phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule18 D:\www\modules\mudule18
call phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule19 D:\www\modules\mudule19
call phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule20 D:\www\modules\mudule20
call phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule21 D:\www\modules\mudule21
call phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule22 D:\www\modules\mudule22
call phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule23 D:\www\modules\mudule23
call phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule24 D:\www\modules\mudule24
call phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule25 D:\www\modules\mudule25
call phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule26 D:\www\modules\mudule26
call phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule27 D:\www\modules\mudule27
call phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule28 D:\www\modules\mudule28
call phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule29 D:\www\modules\mudule29
call phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule30 D:\www\modules\mudule30
call phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule31 D:\www\modules\mudule31
call phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule32 D:\www\modules\mudule32
call phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule33 D:\www\modules\mudule33
call phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule34 D:\www\modules\mudule34
call phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule35 D:\www\modules\mudule35
call phpcs --standard=PHPCompatibility --report-file=D:\www\php7_check\php7_check_report_mudule36 D:\www\modules\mudule36

运行成功!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值