我是脚本新手。我需要代码来接收一些参数并在HTA中的隐藏cmd中执行它。
要执行的命令是 netsh wlan set hosted mode = allow ssid =“name”key =“pwd”
这里我想从提交框中获取“name”和“pwd”并在隐藏的hta中执行上述命令。
我做到了,但工作不正常。参见
<script language="VBScript" type="text/vbscript">
set objShell = CreateObject("WScript.Shell")
strOut=""
sub StartProgram
cmdarg="%comspec% /c netsh wlan set hosted mode=allow ssid=" & T1.value "key=" & T2.value
iReturn=objShell.Run(cmdarg, 0, True)
If iReturn = 0 Then
MsgBox "Success"
Else
MsgBox "Cannot Start"
End If
TraceOut.innerHTML= strOut
end sub
</script>
答案 0 :(得分:0)
我不知道这是否是整个问题,但至少是:
cmdarg="%comspec% /c netsh wlan set hosted mode=allow ssid=" & T1.value "key=" & T2.value
应该是
cmdarg="%comspec% /c netsh wlan set hosted mode=allow ssid=" & T1.value & " key=" & T2.value
换句话说,您在T1.value
之后将&符号留空了,并在key=
之前留出了空格。