在Win2000系統中,可以通過Wscript.Shell對象的Exec方法執行命令,
簡單的代碼如下:
<% Response.Buffer = true %>
<%
url = "www.to
Set objWShell = CreateObject("WScript.Shell")
Set objCmd = objWShell.Exec("ping " & url)
strPResult = objCmd.StdOut.Readall()
set objCmd = nothing: Set objWShell = nothing
strStatus = "離線"
if InStr(strPResult,"TTL=")>0 then strStatus = "在線"
response.write url & " 狀態為: " & strStatus
response.write ".<br>" & replace(strPResult,vbCrLf,"<br>")
response.write "<br><hr>慈勤強編寫,歡迎訪問<a href='http://blog.csdn.net/cQQ'
target='_blank'>http://blog.csdn.net/cqq</a>"
%>
在XP系統或者Windows.NET Server系統中,可以使用WMI來實現,
代碼如下:
當然,我們也可以自己編寫相應的組件或者使用一些現成的組件來實現這樣的功能,
這里就不多說了。
新聞熱點
疑難解答