I've set of cmd command aruments

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

These need to be executed in background if i click a button in the hta and it should not be stopped even if i close hta window. Ie, hta exists but above code executes in background. How can I do it?

有帮助吗?

解决方案

This may get you on the way to your answer...

<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>
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top