C# Open File With Associated Application passing arguments

前端 未结 3 1058
囚心锁ツ
囚心锁ツ 2021-01-24 19:00


I am trying to launch the default application registered for an extension specifying an additional argument:

 ProcessStartInfo p = new ProcessStartInfo();
          


        
3条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-24 19:29

    what exactly is your "argument", does it have spaces, backslash, etc?

        Process process = new Process();
        process.StartInfo.FileName = @"C:\process.exe";
        process.StartInfo.Arguments = @"-r -d something else";
        process.StartInfo.CreateNoWindow = false;
        process.StartInfo.UseShellExecute = false;
        process.Start();
    

    Is there any reason why you cant start the app, then use the extension and arguments in your arguments?

提交回复
热议问题