Run application via shortcut using Process.Start C#

后端 未结 4 761
南笙
南笙 2020-11-29 11:31

Is there a way to run an application via shortcut from a C# application?

I am attempting to run a .lnk from my C# application. The shortcut contains a significant n

相关标签:
4条回答
  • 2020-11-29 11:47

    Setting UseShellExecute = false was the problem. Once I removed that, it stopped crashing.

    0 讨论(0)
  • 2020-11-29 11:48

    If you're using UseShellExecute = false and trying to launch a batch file make sure to add .bat to the end of the filename. You don't need .bat if UseShellExecute = true though. This made me just waste an hour of work... hoping to save someone else.

    0 讨论(0)
  • 2020-11-29 11:50

    Could you post some code. Something like this should work:

    Process proc = new Process();
    proc.StartInfo.FileName = @"c:\myShortcut.lnk";
    proc.Start();
    
    0 讨论(0)
  • 2020-11-29 12:00

    if your file is EXE or another file type like ".exe" or ".mkv" or ".pdf" and you want run that with shortcut link your code must like this.

    i want run "Translator.exe" program.

    Process.Start(@"C:\Users\alireza\Desktop\Translator.exe.lnk");
    
    0 讨论(0)
提交回复
热议问题