是否可以将自定义参数传递给C#应用程序 [英] Is it possible to pass custom Arguments to a C# application

查看:81
本文介绍了是否可以将自定义参数传递给C#应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。



我的情况是我有一个应用程序,通过它我调用另一个.exe来显示一些文件。 exe显示文档具有Adobe activex控件,因此它在构建X86下。因为我的主要应用程序是任何Cpu模式下的bulit(我不能将其更改为X86)我不能让它调用reportvewier应用程序为dll。



我的问题是报告查看器必须为不同的用户采取不同的行动。如果我正在调用一个DLL然后我会构建一个构造函数,并且会在实例化该类和我的问题解决后传递一些参数。

但是这里的senerio是我正在点击一个exe,在调用dll时我无法传递明智的参数。



有没有办法将自定义参数传递给exe,就像我们在调用进程时传递命令行参数一样。



任何帮助将不胜感激..



谢谢你

hello all.

i am in a situation where i have an application through which i am calling another .exe for displyaing some Documents. the exe displaying documents is having Adobe activex controll hence it is under build X86. since my main application is bulit under Any Cpu mode (and i cant change it to X86) i cant make it call reportvewier application as dll.

My problem is report viewer has to act differtntly for different users. if i was calling a dll then i would built a constructor and would have passed some arguments while Instansing that class and my problem would have solved.
but here the senerio is i am hitting an exe to which i will not be able to pass arguments like wise in calling a dll.

is there any way to pass custom arguments to a exe like how we pass command line arguments while calling a process.????

any help will be appreciated..

thank u

推荐答案

是 - 你传递命令行参数! :笑:

当你从命令行运行EXE时,你可以传递你需要的东西:

Yes - you pass it command line arguments! :laugh:
When you run an EXE from teh command line, you can pass what you need:
MyExe D:\Temp\MyFileToPrint.txt /P:EPSON_BX305



当您使用Process.Start运行外部EXE文件时,您也可以这样做:


You can do the same when you use Process.Start to run an external EXE file:

Process.Start("MyExe", @"D:\Temp\MyFileToPrint.txt /P:EPSON_BX305");



MSDN [ ^ ]


这篇关于是否可以将自定义参数传递给C#应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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