首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

windows 2003中 Cmd.exe 授命的调用 asp.net C#

2013-04-20 
windows 2003中 Cmd.exe 指令的调用 asp.net C#,急~我在Xp中用以下代码可以调用cmd命令,执行转化功能,但是

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

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

热点排行