2013-09-21 106 views
0

我設置cmd命令aruments賺關閉HTA

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

這些需要的,如果我在HTA點擊一個按鈕,即使我關閉它不應該被停止時在後臺執行後,執行命令hta窗口。即,hta存在,但上面的代碼在後臺執行。我該怎麼做?

回答

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>