【发布时间】:2016-08-15 20:40:13
【问题描述】:
我已经尝试了很多方法来实现这一点,但还没有以我想要的方式成功。 我有一个 hta 应用程序,它从复选框中收集参数,然后运行一个 cmd 文件,在那里传递这些参数。 如果选中了日志复选框,我想创建该进程的日志文件而不创建任何新的包装文件。
我的逻辑是运行一个带有另一个参数的脚本,并将重定向参数作为参数。而且我无法正确使用语法(或者甚至可能在同一个文件中)。我的简化代码:
Sub RunCmd
dim shell
dim shellWithLog
dim command
dim ARGS
set shell = createobject("Shell.Application")
set shellWithLog = createobject("wscript.shell")
command = "gui.cmd"
if (checkbox1.checked) then
ARGS = ARGS + " Do_This"
end if
if (checkbox2.checked) then
ARGS = ARGS + " Do_That"
end if
if (logFile.checked) then
shellWithLog.run (shell.shellExecute command, ARGS), " &>" + "publishLog.log", 1
else
shell.shellExecute command, , "runas", 1
end if
End Sub
这显然行不通,但至少显示了我想要实现的目标。
【问题讨论】:
标签: vbscript