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

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();
            }

------解决方案--------------------
我来顶
------解决方案--------------------
看不懂要做什么