mahesh
mahesh

Reputation: 3207

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.

Upvotes: 1

Views: 9242

Answers (3)

shenhengbin
shenhengbin

Reputation: 4294

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.

Upvotes: 1

Joey
Joey

Reputation: 354356

"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 ...

Upvotes: 5

PraveenVenu
PraveenVenu

Reputation: 8337

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

Upvotes: 2

Related Questions