Advertisement
tolikpunkoff

Simple create Windows shortcut (LNK)

Oct 12th, 2018
719
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.67 KB | None | 0 0
  1. using IWshRuntimeLibrary;
  2. //...
  3. public static void Create(string ShortcutPath, string TargetPath)
  4. {
  5.     WshShell wshShell = new WshShell(); //создаем объект wsh shell
  6.    
  7.     IWshShortcut Shortcut = (IWshShortcut)wshShell.
  8.         CreateShortcut(ShortcutPath);
  9.  
  10.     Shortcut.TargetPath = TargetPath; //путь к целевому файлу
  11.    
  12.     //если ничего не установить в качестве рабочего каталога
  13.     //рабочим каталогом будет путь к целевому файлу
  14.    
  15.     //стиль окна приложения по умолчанию Normal
  16.  
  17.     Shortcut.Save();
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement