C# 从windows资源管理器将变量传递到.exe文件

C# 从windows资源管理器将变量传递到.exe文件,c#,parameters,windows-explorer,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.Pa

我用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));
}
但是如何使用windows资源管理器中的参数运行.exe文件

编辑:


我将100%传递日期。

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

创建Windows批处理(扩展名为*.bat的文本文件),并在其中指定调用:

MyProg.exe MyFirstArgument MySecondArgument


就这样。有关更多信息,请参阅。

打开Regedit,查找
计算机\HKEY\u类\u根目录\Folder

您将在那里找到
shell\open\command
和defaultentry
%SystemRoot%\Explorer.exe
请给出“字符串”的示例,它是文件名吗?好!Ty表示支持该建议,但如何包含参数?目标的Ex:C:\Users\vincent.pare\Desktop\Projet\AXION\u 2013.06\Utilitaires\OLENotes\bin\Debug\OLENotes。exe@VincP. 只需附加它。使用
目标
框作为命令行。