从服务器在客户端机器上运行Exe文件 [英] Run an Exe file on client mechine from server

查看:198
本文介绍了从服务器在客户端机器上运行Exe文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我想在c#asp.net网站上的客户端系统上的命令提示符中运行带有3个参数的 Exe 文件


在这里,我使用了另一个项目中的代码行来在Windows应用程序中运行命令提示符

Hi All,

I want to run an Exe file in command prompt with 3 parameters on client system from my c# asp.net website


Here I had used the line of coding in another project for running command prompt in windows application

ProcessStartInfo processStartInfo = new ProcessStartInfo("cmd.exe");
processStartInfo.RedirectStandardInput = true;
processStartInfo.RedirectStandardOutput = true;
processStartInfo.UseShellExecute = false;
string cocopath = Application.StartupPath;
processStartInfo.WorkingDirectory = cocopath + "\\CocoImport";
processStartInfo.WindowStyle = ProcessWindowStyle.Maximized;
Process process = Process.Start(processStartInfo);

if (process != null)
{
    string a =  txtinput.Text + " -d";
    string b = txtoutput.Text + " -f";
    process.StandardInput.WriteLine("java -jar CocoImport.jar -s " + a + " " + b);

    process.StandardInput.Close(); 

    string outputString = process.StandardOutput.ReadToEnd();
}





请帮我解决这个问题

谢谢&问候,

Soumya





Pls help me to resolve this

Thanks & Regards,

Soumya

推荐答案

我完全同意其他人(Wes Aday,lewax00,Philip Stuyck)

您必须更改处理方式.您可以执行其他操作,例如将文件导入服务器(从客户端计算机浏览文件),而不是在客户端计算机上运行exe.

如果仍然要在客户端计算机上执行操作,则请转到下面....

ActiveX.(仅在IE上)

Open_Word_Excel_using_JavaScript [ ^ ]
在Mozilla Firefox中运行activex控件 [
I completely agree with others(Wes Aday, lewax00, Philip Stuyck)

You must change the way of process. You could do other thing like importing files to server(Browse file from client machine) instead of running exe on client machine.

If still you want do things on client machine then go below....

ActiveX.(Only on IE)

Open_Word_Excel_using_JavaScript[^]
Running activex controls in Mozilla Firefox[^]


您的代码示例与您要查询的内容无关.如果执行从服务器"执行的任何操作,则表示这是在服务器主机,服务器主机进程上执行的代码.当您将问题标记为"ASP.NET"时,这意味着您正在运行HTTP服务.该服务无权访问任何客户端计算机上的进程.如果可以(想一想这种理论上可能的情况,请等待一秒钟),1)该技术不能称为客户端-服务器" :-); 2)有文化的用户几乎不会希望连接到您的服务,因为他们会感到完全不受自愿和不可预测的(对他们而言)行为或您的服务的保护:谁知道这样的服务会在多大程度上破坏本地系统?

只是关于代码本身的注释:

即使可行,这也是许多查询者(不仅是您)的一个巨大误用,我真的不明白为什么.这使用的是"cmd.exe".这仅是另一个应用程序,仅此而已.您绝对不需要它,应该直接在参数行中使用"java"命令行.

—SA
Your code sample has nothing to do with what you are asking about. If you execute anything "from server", it means this is the code executed on the server host, on the server''s host processes. As you tag your question "ASP.NET", it means you are running an HTTP service. This service has no access to the processes on any client machine, period. If it could (imagine this theoretically possible situation for a second), 1) the technology could not be called "client-server" :-); 2) the literate users would hardly want to connect to your service, as they would feel totally unprotected from voluntary and unpredictable (for them) behavior or your service: who knows how hard could such service screw up a local system?

Just a note on the code itself:

Even when it works, it''s a huge misuse done by many inquirers, not just you, I don''t really understand why. This is using "cmd.exe". This is nothing but yet another application, no more. You absolutely don''t need it, should directly use "java" command line with the parameter line.

—SA


看看Google的本地客户端,远胜于Active X及其不可预测的客户端依赖性.

https://developers.google.com/native-client/devguide/coding/application-structure [^ ]

https://developers.google.com/native-client/overview [
Look at Google''s native client, far better than Active X and its unpredictable client side dependancies.

https://developers.google.com/native-client/devguide/coding/application-structure[^]

https://developers.google.com/native-client/overview[^]


这篇关于从服务器在客户端机器上运行Exe文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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