How to get an HTA application to accept command line arguments?

我的梦境 提交于 2020-02-02 05:02:45

问题


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).


回答1:


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!