0

我已经设置了 cmd 命令参数

@echo off
ping 127.0.0.1 -n 10
netsh wlan stop hosted

如果我单击 hta 中的按钮,这些需要在后台执行,即使我关闭 hta 窗口也不应该停止。即,hta 存在,但上面的代码在后台执行。我该怎么做?

4

1 回答 1

0

这可能会让你在你的答案的路上......

<html>
    <head>
    <title>Ping Ping</title>
    <hta:application
         scroll="no"
         singleinstance="no"
         windowstate="normal"
    >
    </head>

<script type="text/vbscript">

Sub PingSub
  Dim WSHShell
  Dim ComputerName
  ComputerName = "127.0.0.1"

  Set WSHShell = CreateObject("WScript.Shell")
  WSHShell.Run("%comspec% /k ping " & ComputerName & " -t")
End Sub

</script>

<body>

<input id="btnBrowse" type="button" value="Run Pings..." onClick="PingSub" />

</body>
</html>
于 2014-04-25T01:46:33.993 回答