通过批处理脚本调用.exe文件时出现问题

时间:2016-01-13 08:49:07

标签: windows batch-file exe

通过批处理脚本调用.exe文件时遇到问题。以下是我的批处理脚本代码:

@echo off
for /F "tokens=* delims=" %%A in (MyFile.csv) do start " "diffapicmdline.exe /lhscd "/d=localhost:9080 /h=localhost /u=user1 /p=Pwd123 %%A" /rhscd "/d=localhost:9080 /h=localhost /u=user1 /p=Pwd123 Prjct %%A" /t job /ot html /ol "C:\compare_output_H_S_Component.html""

因此,MyFile.csv文件diffapicmdline.exe中的每一行都应该每次调用。

但问题是它不能识别.exe之后的参数。我们是否必须转义字符或找到其他方法告诉批处理脚本成功运行.exe?

我在这里收到错误:

Windows can't find 'diffapicmdline.exe /lhscd "/d=localhost:9080'. 
Make sure you typed the name correctly, and then try again.

1 个答案:

答案 0 :(得分:0)

这会更好吗,在线调用exe而不是启动新的CMD流程?

@echo off
for /F "tokens=* delims=" %%A in (MyFile.csv) do diffapicmdline.exe /lhscd "/d=localhost:9080 /h=localhost /u=user1 /p=Pwd123 %%A" /rhscd "/d=localhost:9080 /h=localhost /u=user1 /p=Pwd123 Prjct %%A" /t job /ot html /ol "C:\compare_output_H_S_Component.html"