Turkalp Kucur

Turkalp Kucur

  • NA
  • 50
  • 19k

how to change c# form app to c# console app?

Feb 11 2013 8:59 PM
Hello My friends

I have a c# form which gets an image then outputs .txt 


My aim is, I want to run int via console. For example when I type
>>ocr  hello.jpg d:

It will run (with 1st argument filename: ocr) , get hello.jpg  (second argument: input file) then save the hello.txt to d: (3rd last argument: path)

I have found a nice example which I attached. I can get the row number of arguments but I could not get the values.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace hello
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Number of arguments:" + args.Length);
            for (int i = 0; i < args.Length; i++)
            {
                Console.WriteLine("Argument#" + i + ":" + args);
            }
            Console.ReadLine();
        }
    }
}


So, how could I pass the arguments to run it in this manner?

any idea, help will be so helpful.

I am waiting.




Answers (2)