啊会是.net用户的权限有要特殊设置的。如果我的命令改为“dir”没有问题。

解决方案 »

  1.   

    正巧偶最近也碰到这个问题HOHO
    问题出在Server.MapPath(".")这个东西取到的路径是带转义字符的,就是说它取到的路径像这样
    d:\\test\\aaa.txt
    你可以把这里换成一个本地路径试试就知道了
      

  2.   

    ProcessStartInfo的Arguments,不代表命令后面的参数。我的做法是把命令写入bat文件,或者自己生成bat文件,然后调用。
      

  3.   

    to :duke731(沙僧) 
      和Server.MapPath(".")应该没有关系的,我把最终的命令打出来的:
    rtopcb /s /i D:\基础数据平台\ViewTable\script\05080157.dtf 是没有问题的。
      

  4.   

    要不你照这样试试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;                        // not display window
                            p.StartInfo.CreateNoWindow = true;                        p.Start();                        p.StandardInput.WriteLine("net start AutoReport ");                        p.StandardInput.WriteLine("exit");                        //string strRst = p.StandardOutput.ReadToEnd();
                            p.Close();
      

  5.   

    duke731谢谢,我以前就试过了,没有用。
      

  6.   

    ms不因该啊
    看下web权限下rtopcb 能访问 D:\基础数据平台\ViewTable\script\05080157.dtf么
      

  7.   

    如果是windows应用程序没有问题可以取到数据,如果是编写成windows服务也和前面一样取不到数据。晕死啊!!!!!!!!!!!!!!!!!!!!!!!!!!!1