C#发布.exe并使用cmd向其发送参数 [英] C# publishing an .exe and sending params to it using cmd
问题描述
我很确定这是基本的,但我只是做不到而已我正在尝试创建一个控制台应用程序,该应用程序将通过获取很少的参数来完成ABC
i am pretty sure this is basic but i just dont success to do this i am trying to create a console application that would do ABC by getting few arguments
首先,我正在尝试运行像这样简单的东西
for start i am trying to run something as simple as that
static void Main(string[] args)
{
foreach (var s in args)
{
Console.WriteLine(s);
}
Console.ReadLine();
}
当我发布它时,它作为一个"clickonce"项目出现例如NAME.application而不是NAME.exe
when i publish it it comes at as a 'clickonce' project like NAME.application instead of NAME.exe
也,当我尝试使用XYZ parms执行它时,例如在命令行中的同一文件夹中尝试
also , when i am trying to go execute it with XYZ parms like trying in same folder in command line
NAME.application agr1 agr2 agr3
它只是使用空控制台打开应用程序:(
it just opens the application with empty console :(
推荐答案
.application
文件不是您的可执行文件,而是用于部署的文件.因此,在本地运行程序时,仍应运行 .exe.
文件.在此处查看有关命令行参数和ClickOnce的一些信息:""
The .application
file is not your executable file, but a file used for the deployment. So when running the program locally, you should still run the .exe.
file. Check here for some info about command line arguments and ClickOnce: "Simulating command line parameters in Click Once applications"
这篇关于C#发布.exe并使用cmd向其发送参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!