简体   繁体   English

使用.bat文件执行C#控制台应用程序(.exe)

[英]Execute C# console application(.exe) using .bat file

I wrote a C# Console Application which takes one argument. 我编写了一个带有一个参数的C#控制台应用程序。 The application runs successfully with visual studio. 该应用程序可以在Visual Studio中成功运行。 After build/re-build, I have copied the bin/debug directory contents into c:\\batch folder (deployed) I want to run the exe from this directory using a bat file which I created in the c:\\batch folder. 生成/重新生成后,我已将bin / debug目录内容复制到c:\\ batch文件夹中(已部署),我想使用在c:\\ batch文件夹中创建的bat文件从该目录运行exe。 But it is not running. 但是它没有运行。 I tried the following in bat file 我在bat文件中尝试了以下内容

1) start /d "c:\batch" myapp.exe arg1
2) start /d "" myapp.exe arg1
3) myapp.exe arg1

I was not able to run this using task scheduler when I run this through cmd it says start not recognized. 当我通过cmd运行它无法识别启动时,我无法使用任务计划程序运行它。 What else am I missing? 我还想念什么?

Dont use the debug Version. 不要使用调试版本。 You need to build a "Release Version". 您需要构建一个“发行版本”。 (Click the dropdown button where debug is located) This will then be located in the release folder. (单击位于调试位置的下拉按钮),然后它将位于发布文件夹中。

also use "START" 也使用“ START”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM