关于调用CMD的问题!急! 啊会是.net用户的权限有要特殊设置的。如果我的命令改为“dir”没有问题。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 正巧偶最近也碰到这个问题HOHO问题出在Server.MapPath(".")这个东西取到的路径是带转义字符的,就是说它取到的路径像这样d:\\test\\aaa.txt你可以把这里换成一个本地路径试试就知道了 ProcessStartInfo的Arguments,不代表命令后面的参数。我的做法是把命令写入bat文件,或者自己生成bat文件,然后调用。 to :duke731(沙僧) 和Server.MapPath(".")应该没有关系的,我把最终的命令打出来的:rtopcb /s /i D:\基础数据平台\ViewTable\script\05080157.dtf 是没有问题的。 要不你照这样试试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(); duke731谢谢,我以前就试过了,没有用。 ms不因该啊看下web权限下rtopcb 能访问 D:\基础数据平台\ViewTable\script\05080157.dtf么 如果是windows应用程序没有问题可以取到数据,如果是编写成windows服务也和前面一样取不到数据。晕死啊!!!!!!!!!!!!!!!!!!!!!!!!!!!1 C# 结构体中结构体 C# 一个容器里的控件如何移动到另一个容器里,并能在另一个容器里自动改变大小 为什么VB不能反编译 C#可以 C#做了一个登录界面,用combobox选择服务器和数据库 silverlight 应用程序获取所在页面的参数 .net Remoting 的简单问题~~~巨分相送,帮顶有分 customErrors设置后如何把发生异常页的Exception传入错误处理页? remoting 问题 [GduUI类库]C# WinForm控件分享 用c#写的一个类库,用csc编译后,引用到web form里怎么使用阿? c#程序能逃得过杀毒软件的一键加速吗? sos
问题出在Server.MapPath(".")这个东西取到的路径是带转义字符的,就是说它取到的路径像这样
d:\\test\\aaa.txt
你可以把这里换成一个本地路径试试就知道了
和Server.MapPath(".")应该没有关系的,我把最终的命令打出来的:
rtopcb /s /i D:\基础数据平台\ViewTable\script\05080157.dtf 是没有问题的。
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();
看下web权限下rtopcb 能访问 D:\基础数据平台\ViewTable\script\05080157.dtf么