使用的Process.Start C#通过快捷方式运行应用程序 [英] Run application via shortcut using Process.Start C#
问题描述
有没有办法运行通过快捷键,C#应用程序?
应用程序我试图从我的C#应用程序运行的.lnk。快捷方式中包含的,我会preFER应用程序不必记住参数的显著数量。
试图运行快捷方式通过的Process.Start导致异常。
感谢
编辑:
唯一的例外是Win32Exception:指定的可执行文件是不是有效的Win32应用程序
下面是(略)code:
的ProcessStartInfo信息=新的ProcessStartInfo(example.lnk);
info.CreateNoWindow = TRUE;
info.UseShellExecute = FALSE;
info.RedirectStandardError = TRUE;
info.RedirectStandardOutput = TRUE;
info.RedirectStandardInput = TRUE;
无论工艺=的Process.Start(信息);
设置 UseShellExecute = FALSE
是问题。一旦我删除,它停止崩溃。
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 number of arguments that I would prefer the application not have to remember.
Attempting to run a shortcut via Process.Start causes an exception.
Thanks
EDIT:
The exception is a "Win32Exception": "The specified executable is not a valid Win32 application."
Here is the (abbreviated) code:
ProcessStartInfo info = new ProcessStartInfo ( "example.lnk" );
info.CreateNoWindow = true;
info.UseShellExecute = false;
info.RedirectStandardError = true;
info.RedirectStandardOutput = true;
info.RedirectStandardInput = true;
Process whatever = Process.Start( info );
Setting UseShellExecute = false
was the problem. Once I removed that, it stopped crashing.
这篇关于使用的Process.Start C#通过快捷方式运行应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!