简体   繁体   中英

How to execute c# console application from batch file

I have the sample console application which is supposed to be executed in the startup task, i want to execute the console application through batch file, please can i know the right syntax to execute it.

"C:\Users\mahesh\Documents\Visual Studio Projects\Foo\bin\Debug\Foo.exe"
Foo
Foo.exe
"\Some other folder\foo"

would all be possible options how to execute it, depending on where the program resides and what your current working directory is...

just put the full path of the console application.exe file in the batch file.

In my project.

Folder is like

D:\Run
│  main.bat  >> your batch file
│  
└─Test
    │  
    │  
    └─your application

Content of the bat file is like

cd /d %~dp0test\
Checker.exe>check.log

The first line

cd /d %~dp0test\

is replace the runtime directory to the full path of the appliction file.

>check.log

Is an option to output the log file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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