在批处理文件中运行带参数的命令

时间:2013-04-19 09:04:45

标签: windows command-line batch-file cmd

假设一个伪命令:

 psuedocmd.exe

它有各种参数,如:

/scan  /save  /savefolder

现在我想使用批处理文件运行psuedocmd.exe。 我也想使用参数。 我在批处理文件中使用以下行

psuedocmd.exe /scan /save

但是在这种情况下,psuedocmd.exe在没有参数的情况下运行。

2 个答案:

答案 0 :(得分:0)

尝试在引号"parameter value"之间放置参数,尤其是路径中包含空格时。

检查批处理文本文件是否未以某种编码方式保存,使/成为转义字符。

如果要通过从批处理文件中移交参数来运行.exe,请不要使用变量,只需使用%1,%2等。

run.bat /save /folder

run.bat的内容是:

pseudocommand.exe %1 %2

答案 1 :(得分:0)

呵呵,经过半年多的时间,我已经没有耐心了......

Acunetix Web Vulnerability Scanner中使用savefolder参数时,您必须提供save参数,使批处理文件中的该行如下所示:

wvs_console.exe /scan "http://www.aaa.com" /save /savefolder "c:\log" 

摘自文件:

/scan          Scans a single website.
               Syntax: /scan [url]
               Example: /scan http://testphp.vulnweb.com

/save          Saves scan once scan is finished. The file will be 
                 saved in the location specified by the “/savefolder” switch.
               Syntax: /save

/savefolder    Specify the folder were all the scans and other 
                 scan related files will be saved.
               Syntax: /savefolder [directory]
               Example: /savefolder C:\Acunetix\Scans