网页程序 Asp。Net
开发工具:Vs2010
服务器操作系统:Windows 2008 Server
IIS:7.5我写了个程序用Process 执行一个cmd.exe的指令!
但是为什么不能执行那!
代码如下:cmd = new string[] { "cd d:/temp","d:","java -jar AXMLPrinter2.jar AndroidManifest.xml"};
Process p = new Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;//可能接受来自调用程序的输入信息
p.StartInfo.RedirectStandardOutput = true;//由调用程序获取输出信息
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;//不显示程序窗口
p.Start();
p.StandardInput.AutoFlush = true;
for (int i = 0; i < cmd.Length; i++)
{
     p.StandardInput.WriteLine(cmd[i]);
}
p.StandardInput.WriteLine("exit");
string strRst = p.StandardOutput.ReadToEnd();
我在本机打印出来strRst是:
Microsoft Windows [版本 6.1.7601]
版权所有 (c) 2009 Microsoft Corporation。保留所有权利。C:\Users\TOM>cd d:/tempC:\Users\TOM>d:d:\temp>java -jar AXMLPrinter2.jar AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:versionCode="24"
        android:versionName="1.14.0.12".....
d:\temp>exit;但是我在服务器上打印出来的是:
Microsoft Windows [版本 6.0.6002] 版权所有 (C) 2006 Microsoft Corporation。保留所有权利。 
c:\windows\system32\inetsrv>cd d:/temp 
c:\windows\system32\inetsrv>d: 
c:\windows\system32\inetsrv>java -jar AXMLPrinter2.jar AndroidManifest.xml 
c:\windows\system32\inetsrv>exit 给我感觉就是cmd好像就是没有回车!就是无法执行!不知道是IIS设置有问题还是我代码写的有问题。请各位前辈赐教!