如何通过命令行参数的批处理文件? [英] How to pass command line parameters to a batch file?
本文介绍了如何通过命令行参数的批处理文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要运行,而不是硬编码他们到文件的时候把ID和密码一个cmd(或蝙蝠)的文件。
下面就是在命令行中的样子:
TEST.CMD管理2P @ 55w0rd>测试的log.txt
解决方案
下面就是我如何做到这一点。
@假命令/ U%1 / P 2%
下面就是在命令行中的样子:
TEST.CMD管理2P @ 55w0rd>测试的log.txt
%1适用于第一个参数%2(这里的棘手的部分)适用于第二位。最多可以有以这种方式通过9个参数。
I need to pass id and password to a cmd (or bat) file at the time of running rather than hardcoding them into the file.
Here's what the command line looks like:
test.cmd admin P@55w0rd > test-log.txt
解决方案
Here's how I do it.
@fake-command /u %1 /p %2
Here's what the command line looks like:
test.cmd admin P@55w0rd > test-log.txt
The %1 applies to the first parameter the %2 (and here's the tricky part) applies to the second. You can have up to 9 parameters passed in this way.
这篇关于如何通过命令行参数的批处理文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文