从共享应用程序打开命令提示符时出现问题. [英] Having Problem while opening command prompt from shared application.

查看:100
本文介绍了从共享应用程序打开命令提示符时出现问题.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个已部署在Shared Server上的Windows应用程序.我的应用程序将调用命令提示符以执行一些数据库操作.如果我从共享位置运行该应用程序,则遇到问题.如果运行该应用程序,则没有任何问题在部署的服务器中.我面临的问题如下.

我在调用时将几个参数传递给命令提示符.如果我从共享位置打开应用程序并且它不执行我传递的参数,则会收到以下消息.

使用上面的路径作为当前目录启动了CMD.EXE.
不支持UNC路径.默认为Windows目录.
Microsoft Windows XP [版本5.1.2600]
(C)版权所有1985-2001 Microsoft Corp.

命令提示符调用代码如下:
通常,命令参数将包含"@" CD \&& C:&& CD \&& CD MyFolder&& CD MySubFolder \ App.bat"

Hi ,

I have a windows application which has been deployed on Shared Server.My Application will invoke a command prompt to do some db operations.I am facing problems if i run the application from shared location.I am not facing any problem if i run the application with in the deployed server.The problem i am facing as follows.

I am passing few arguments to the command prompt while invoking.I am getting the following message if i open the application from shared location and it is not executing the arguments what ever i passed.

CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

Command Prompt invocation code as follows:
Typically command arguments would contain "@"CD \&&C:&&CD\&&CD MyFolder &&CD MySubFolder\App.bat""

<code>ProcessStartInfo procStartInfo = new ProcessStartInfo("cmd",  command.ToString());
procStartInfo.RedirectStandardOutput = true;
procStartInfo.UseShellExecute = false;
procStartInfo.CreateNoWindow = true;
Process proc = new Process();
proc.StartInfo = procStartInfo;
proc.Start();
string result = proc.StandardOutput.ReadToEnd();
return result;</code>



如果我也直接运行.bat文件,我也会遇到同样的问题.
如果有人对此有任何建议,请提出建议.
提前谢谢.


谢谢,
Venkat Malladi.



I am getting same problem If i run the .bat file directly as well.
Please suggest me if anybody has clue on this.
Thanks in advance.


Thanks,
Venkat Malladi.

推荐答案

我认为问题中显示的命令示例没有任何问题.

该问题应该与不支持UNC名称的名称一起出现.您是否尝试在某些命令中使用计算机名称?在某些情况下,也许您生成的命令不正确,所以它类似于使用带有双反斜杠的UNC格式.

关于UNC,请参见 http://en.wikipedia.org/wiki/Uniform_Naming_Convention#Uniform_Naming_Convention [ ^ ].

为什么要那样做?

—SA
I don''t think anything is wrong with the command sample you show in your question.

The problem should come with the name looking like UNC name, which is not supported. Do you try to use machine name in some commands? Maybe you have incorrectly generated command in some cases, so it resembles using UNC format with double back slash.

About UNC, see http://en.wikipedia.org/wiki/Uniform_Naming_Convention#Uniform_Naming_Convention[^].

Why doing all that?

—SA


错误非常明显:不支持UNC路径."

您必须将驱动器映射到UNC路径,并在代码中使用该驱动器路径.
The error is quite clear: ''UNC paths are not supported.''.

You must map a drive to your UNC path and use the drive path in your code.



我通过将工作目录设置为Process解决了该问题.
谢谢,
Venkat Malladi.
Hi ,
I resolved the issue by setting working directory to the Process.
Thanks,
Venkat Malladi.


这篇关于从共享应用程序打开命令提示符时出现问题.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆