gpt4 book ai didi

c# - 使用 Process.Start() 通过快捷方式运行应用程序

转载 作者:可可西里 更新时间:2023-11-01 08:56:52 25 4
gpt4 key购买 nike

有没有办法通过 C# 应用程序的快捷方式运行应用程序?

我正在尝试从我的 C# 应用程序运行 .lnk。该快捷方式包含大量参数,我希望应用程序不必记住这些参数。

尝试通过 Process.Start() 运行快捷方式会导致异常。

Win32Exception: The specified executable is not a valid Win32 application

这是我正在使用的代码。

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 );

最佳答案

你能发布一些代码吗?这样的事情应该有效:

Process proc = new Process();
proc.StartInfo.FileName = @"c:\myShortcut.lnk";
proc.Start();

关于c# - 使用 Process.Start() 通过快捷方式运行应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6141821/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com