Home >Backend Development >C++ >How to Easily Create Application Shortcuts in .NET using the ShellLink Class?
Generating application shortcuts in .NET isn't always intuitive. The ShellLink.cs
class from vbAccelerator offers a streamlined approach, providing an elegant solution without relying on WSH.
Here's how to easily create a shortcut using ShellLink:
<code class="language-csharp">private static void configStep_addShortcutToStartupGroup() { using (ShellLink shortcut = new ShellLink()) { shortcut.Target = Application.ExecutablePath; shortcut.WorkingDirectory = Path.GetDirectoryName(Application.ExecutablePath); shortcut.Description = "My Shortcut Name Here"; shortcut.DisplayMode = ShellLink.LinkDisplayMode.edmNormal; shortcut.Save(STARTUP_SHORTCUT_FILEPATH); } }</code>
This concise code snippet creates and saves a shortcut, defining its target, working directory, description, and display mode. The ShellLink class simplifies the process, allowing for effortless shortcut creation in any specified location.
The above is the detailed content of How to Easily Create Application Shortcuts in .NET using the ShellLink Class?. For more information, please follow other related articles on the PHP Chinese website!