Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run a c# application with arguments from a batch file

I have a C# project that takes in arguments that I'm trying to run from a bat file. For an application that doesn't take arguments I just put the following inside a file called run.bat

pathname\helloworld\bin\Debug\helloworld.exe 

What if my program takes in parameters, how do I adjust. When is the echo of used? any good tutorial on writing batch files? Thanks

like image 968
Luke Makk Avatar asked Mar 22 '23 21:03

Luke Makk


1 Answers

pathname\helloworld\bin\Debug\helloworld.exe "argument 1" "argument 2" 3

using System;
public class Demo {
    public static void Main(string[] args) {
        foreach(string arg in args)
            Console.WriteLine(arg);
    }
}
like image 173
Louis Ricci Avatar answered Apr 06 '23 18:04

Louis Ricci