To create a desktop shortcut in C#, you can use the IWshRuntimeLibrary
COM library. Here's an example code that creates a shortcut for a file:
main.cs740 chars21 lines
To use this method, you need to pass two parameters: filePath
, the path of the file for which you want to create a shortcut, and shortcutPath
, the path where you want to save the shortcut (including the .lnk
extension). For example:
main.cs80 chars2 lines
gistlibby LogSnag