运行控制台应用程序与参数从C# - GUI Hookup建议 [英] Running a console app with arguments from C# - GUI Hookup Advice
问题描述
(警告:这是一个C#n00b问题!尝试学习一点C#,同时使一个控制台应用程序更容易一些我经常运行。)
(Warning: This is a C# n00b question! Trying to learn a bit of C# while making things easier for a console app I run frequently.)
尝试运行控制台应用程序( consoleapp.exe
),而不必手动键入参数每次 - 命令通常是这种形式:
I'm trying to run a console application (consoleapp.exe
) without having to manually type in the arguments each time - The command is typically of this form:
C:/consoleapp.exe --username(uname)--password(pass)--inputfilec:/pathtofile/filename.xml
使用C#我甚至可以加载Windows资源管理器文件提示,而不必每次手动输入文件路径。我将如何做这个?
Using C# I might even be able to load up a Windows explorer file prompt, instead of having to manually type in the file path each time. How would I go about doing this?
我试过此链接的代码段。我得到它的工作,只是替换 ApplicationPath
与路径到我的cojnsole应用程序和 ApplicationArguments
与显示的参数除了我不知道如何使用VC#GUI工具连接参数,或者中继从原始控制台应用程序获取的输出。
I tried the snippet at this link. I got it to work by just replacing the ApplicationPath
with the path to my cojnsole app, and ApplicationArguments
with the arguments shown in the format above, except I'm not sure how to hook up the parameters with the VC# GUI tools, or to relay the output I get from the original console app back.
推荐答案
这不是以上问题的答案 - 请参阅上面的问题。
This is not answer to question above -- see comments to question above.
在项目属性对话框中的调试标签上,您可以定义命令行参数和工作目录。
In Project Properties dialog, on Debug tab you can define command line arguments and working directory.
这篇关于运行控制台应用程序与参数从C# - GUI Hookup建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!