从Windows资源管理器将变量传递给.exe文件

Vin*_*c 웃 0 c# parameters windows-explorer

我在c#中做了一个简单的项目.要执行此程序,您必须传递一个字符串.

static void Main(string[] args)
{
    DateTime? dtDebut = null;
    if (args.Length > 0)
       dtDebut = DateTime.Parse(args[0]);

    DateTime? dtFin = null;
    if (args.Length > 1)
       dtFin = DateTime.Parse(args[1]);

    bool bGetDateFromTable = true;
    if (args.Length > 2)
       bGetDateFromTable = Boolean.Parse(args[2]);


    ObjetAXION objetAXION = recupererAxion();

    DateTime date1 = DateTime.Now;
    AXION.OLENotes.ScanFiles(objetAXION, dtDebut, dtFin, bGetDateFromTable);
    DateTime date2 = DateTime.Now;
    Console.WriteLine("Temps du scan: " + (date2 - date1));
}
Run Code Online (Sandbox Code Playgroud)

但是如何使用Windows资源管理器中的参数运行.exe文件?

编辑:

我将100%通过约会.

Dan*_*ite 6

创建程序的快捷方式.编辑快捷方式的目标(在快捷方式的属性窗口中)以包含命令行参数.