我会尽量保持这个基本。我试图在服务器端(而不是客户端)运行一个shell。我已经分解了我的代码,所以它非常基础。现在,如果我使用CreateObject(“Wscript.shell”)在客户端运行它,它将在浏览器中'document.write'用户。Server.CreateObject(“Wscript.Shell”)问题 - 对象服务器需要错误? ASP/VBscript错误
<script type="text/vbscript" >
Set Shell = CreateObject("WScript.Shell")
Set whoami = shell.exec("whoami")
Set whoamiOutput = whoami.StdOut
strWhoamiOutput = whoamiOutput.ReadAll
document.write strWhoamiOutput
</script>
现在,如果我改变我的代码在服务器端运行:
<script type="text/vbscript" >
Set Shell = Server.CreateObject("WScript.Shell")
Set whoami = shell.exec("whoami")
Set whoamiOutput = whoami.StdOut
strWhoamiOutput = whoamiOutput.ReadAll
document.write strWhoamiOutput
</script>
我得到了我的浏览器告诉我一个错误“所需的对象:服务器”在第11行第11行是'Server.CreateObject'行。我在这里错过了什么?
感谢
昨天我确实发现我需要使用response.write,如果我正在执行服务器,我正在尝试。但你也是对的,我在服务器上遇到了停止运行命令。我的实际脚本试图执行SQLCMD,当我在服务器上执行它时,这是一个问题。 CMD与服务器帐户一起运行,而不是我指定的AppPool PIN,它具有运行SQLCMD所需的访问权限。我在这一点上研究了一些其他的选择。 –