我目前正在尝试创建一个安装工具。我有一个批处理文件调用一些sqlcmd命令,我想从Autoit触发它。它有效。
现在,我想在Autoit中设置变量(通过从GUI获取)并在调用时将其传递给批处理文件。它应该是这样的:
RunWait('path_of_file\mybat.bat' & %myVar%)
我从Autoit社区中读了很多,却没有找到答案。我有类似的东西:
RunWait('path_of_file\mybat.bat' & " " & $myVar) <- This solution didn't work for me
或
RunWait(@ComSpec & " /k "...) <- This one didn't suit what I'd like to do, as I'm
launching a batchfile and not a cmd command.
如果有人有想法!
提前致谢:)
答案 0 :(得分:2)
这应该有效:
自动运作
Local $myVar = "ipconfig"
RunWait('mybat.bat ' & $myVar)
自动也适用
ShellExecute("mybat.bat", $myVar)
mybat.bat
@echo off
echo %1
%1
ping 127.0.0.1 -n 6 > nul