|
![]() |
名片设计 CorelDRAW Illustrator AuotoCAD Painter 其他软件 Photoshop Fireworks Flash |
|
使用WSH调用系统的Ping命令,将Ping的结果重定向到一个文本文件中去,再把文本文件显示到网页中 详细做法如下: 首先, 建一个.BAT文件(例如:myPing.BAT:),这个文件要在ASP中调用,文件代码如下: ping -a %1 > d:INetPubcgi-bin%2.txt (%1)是将来要ping的地址, (%2)是存储ping结果的文件. 以下是ASP的代码: < % Set FileSys = Server.CreateObject("Scripting.FileSystemObject") FileName = FileSys.GetTempName Set WShShell = Server.CreateObject("WScript.Shell") IP = "xxx.xxx.xxx.xxx" ’你要ping的地址 RetCode = WShShell.Run("d:Inetpubcgi-binmyPing.bat " & IP & " " & FileName, 1, True) if RetCode = 0 Then ’没有错误 else Response.Redirect "PingErrors.htm" end if Set TextFile = FileSys.OpenTextFile("d:InetPubcgi-bin" & FileName & ".txt", 1) TextBuffer = TextFile.ReadAll For i = 1 to Len(TextBuffer) If Mid(TextBuffer,i,1) = chr(13) Then Response.Write("") else Response.Write(Mid(TextBuffer,i,1)) end if Next TextFile.Close FileSys.DeleteFile "d:Inetpubcgi-bin" & FileName & ".txt" % > 返回类别: 教程 上一教程: 利用ASP打造网站论坛DIY -4 下一教程: 在ASP中处理数据库的NULL记录 您可以阅读与"ASP调用系统PING命令"相关的教程: · 可以执行系统命令的ASP原码放送 · 在ASP中执行PING命令,并且返回结果 · 可以这行系统命令的ASP原码放松 · 用ASP开发试题库与在线考试系统(7) · ASP调用ORACLE存储过程并返回结果集 |
![]() ![]() |
快精灵印艺坊 版权所有 |
首页![]() ![]() ![]() ![]() ![]() ![]() ![]() |