Sub Window_onLoad
arrCommands = Split(ITTool.commandLine, chr(34))
For i = 3 to (Ubound(arrCommands) - 1) Step 2
MsgBox arrCommands(i)
Next
End Sub
When I run my HTA application, I get:
arrCommands is undefined
I am trying to make an HTA app that accepts command line arguments (optional).
Your script section contains an Option Explicit
statement. That makes defining variables before you can use them mandatory. Add a line Dim arrCommands, i
to your procedure:
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
来源:https://stackoverflow.com/questions/32594555/how-to-get-an-hta-application-to-accept-command-line-arguments