读书人

windows 2003中 Cmd.exe 授命的调用 a

发布时间: 2013-04-20 19:43:01 作者: rapoo

windows 2003中 Cmd.exe 指令的调用 asp.net C#,急~
我在Xp中用以下代码可以调用cmd命令,执行转化功能,但是在Win2003Server中却不可以调用Cmd指令,据说serve2003的IIS6.0,不支持,求调用方法!!


string fppath = System.Configuration.ConfigurationManager.AppSettings["FlashPaperPath"];
fppath = Server.MapPath(fppath);
string param = fppath + " " + filepath + " -o " + Server.MapPath(outpath);
string sys = Environment.SystemDirectory;

p.StartInfo.FileName = Environment.SystemDirectory + "\\cmd.exe";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
try
{
p.Start();
string strOutput = null;
p.StandardInput.WriteLine(param);
p.StandardInput.WriteLine("exit");
strOutput = p.StandardOutput.ReadToEnd();
Console.WriteLine(strOutput);
Thread.Sleep(5000);//等待转化
p.WaitForExit();
p.Close();
}
catch (Exception ex)
{
return "转化异常:" + ex.ToString();
}

[解决办法]
我来顶
[解决办法]
看不懂要做什么

读书人网 >C#

热点推荐