日期:2014-05-17  浏览次数:21191 次

打开网页执行指定的命令。DOS命令
打开网页执行指定的命令。DOS命令
这样的效果怎么实现?
做按钮也可以~!

------解决方案--------------------
dos命令应该不可以执行吧?你要执行什么命令啊?
------解决方案--------------------
<%@ Language= "VBScript " %>
<% Option Explicit
response.Buffer=false
dim val
val=Trim(request( "val "))
%>
<html>
<head>
<title> --運行-- </title>
<style type= "text/css ">
<!--
.td {
font-size: 9pt;
font-weight: bold;
color: #CCCCCC;
}
.sHistory {
behavior:url(#default#savehistory);
}
-->
</style>
<script language= "javascript ">
function sel_keypress(){
if(window.event.keyCode==38)
{
document.all( "Val ").value= " <%=val%> "
}
}
</script>
<link rel= "Shortcut Icon " href= "CMD.ico ">
<meta http-equiv= "Content-Type " content= "text/html; charset=big5 "> </head>
<body bgcolor= "#000000 " class= "td " leftmargin= "10 " onkeydown= "javascript:sel_keypress() " onLoad= "window.resizeTo(window.screen.width/5*3+55,window.screen.height/5*3-30);window.moveTo(200,200);window.status=undefined;window.toolbar=undefined;window.menubar=undefined " scroll=yes>
<form name= "form1 " method= "get " action= " ">
<%
if val <> " " then
if val= "exit " then%>
<script language= "javascript ">
window.close();
</script>
<%end if
'if val= "ipconfig " or (instr(val, "ping ")> 0 and instr(val, "-t ") <=0) or instr(val, "netstat ")> 0 then 'or instr(val, "regsvr32 ")> 0
dim strHost
dim oShell,oFS,oTF
dim i,Data,tempData
strHost= "config "
Set oFS = Server.CreateObject( "Scripting.FileSystemObject ")
if oFS.FileExists(server.MapPath(strHost & ".txt ")) then
on error resume next
oFS.DeleteFile server.MapPath(strHost & ".txt ")
if err then
response.Write(err.description)
response.End()
end if
end if
Set oShell = Server.CreateObject( "Wscript.Shell ")
oShell.Run "%ComSpec% /c "&Trim(request( "val "))& " > "&server.MapPath(strHost & ".txt "), 0, True
Set oTF = oFS.OpenTextFile(server.MapPath(strHost & ".txt "))
Do While Not oTF.AtEndOfStream
Data = Trim(oTF.Readline)
If i > 2 Then
tempData = tempData & Data & " <BR> "
End If
i = (i + 1)
Loop
response.write tempData
oTF.Close
oFS.DeleteFile server.MapPath(strHost & ".txt ")
Set oFS = Nothing
'else
'if instr(Request.ServerVariables( "QUERY_STRING "), "Val ")> 0 then
' response.Write( "不支持該命令! <br> ")
'end if
'end if
end if
%>
<input name= "Val " style= "background-color:#000000;border-color:#000000;color:#CCCCCC;font:bold; border:0;width:100%; " onBlur= "javascript:this.focus(); " value= " " class= "sHistory ">
</form>
<script langu