Sub Window_onLoad
arrCommands = Split(ITTool.commandLine, chr(34))
For i = 3 to (Ubound(arrCommands) - 1) Step 2
MsgBox arrCommands(i)
Next
End Sub
当我运行我的 HTA 应用程序时,我得到:
arrCommands is undefined
我正在尝试制作一个 HTA 应用程序 accepts command line arguments (可选的)。
最佳答案
您的脚本部分包含 Option Explicit
陈述。这使得必须先定义变量,然后才能使用它们。添加一行 Dim arrCommands, i
到您的程序:
Sub Window_onLoad
Dim arrCommands, i
arrCommands = Split(ITTool.commandLine, chr(34))
For i = 3 to (Ubound(arrCommands) - 1) Step 2
MsgBox arrCommands(i)
Next
End Sub
关于vbscript - 如何让 HTA 应用程序接受命令行参数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32594555/