

- #HOW TO CREATE A SHORTCUT ON DESKTOP FOR WEBSITE WINDOWS 10 HOW TO#
- #HOW TO CREATE A SHORTCUT ON DESKTOP FOR WEBSITE WINDOWS 10 CODE#
- #HOW TO CREATE A SHORTCUT ON DESKTOP FOR WEBSITE WINDOWS 10 PC#
You can now give the shortcut a name > Click on Finish In the location box type “ shutdown /r“ģ. Right-click your desktop > New > ShortcutĢ.
#HOW TO CREATE A SHORTCUT ON DESKTOP FOR WEBSITE WINDOWS 10 HOW TO#
How To Add Restart Shortcut To Your Windows 10 Desktop:ġ. You can also set a keyboard shortcut to make Windows 10 restart. This is a very fast way of restarting your computer as there is no need to open the start menu then click power and restart.īut just remember to ensure you have saved all of your work before clicking the shortcut as your system will restart very quickly.

#HOW TO CREATE A SHORTCUT ON DESKTOP FOR WEBSITE WINDOWS 10 PC#
In this post, we will be showing you how you can add a desktop shortcut that will restart your Windows 10 PC or Laptop. Var startupFolderPath = 10 Desktop Shortcut To Restart Computer Public static string CreateShortCutInStartUpFolder(string exeName, string startIn, string description) test.exe as found in the current directory / Creates a shortcut in the startup folder from a exe as found in the current directory. Here's a (Tested) Extension Method, with comments to help you out. Private static object InvokeMethod(this Type type, string methodName, object targetInstance, params object arguments)īindingFlags.Public | BindingFlags.Instance | BindingFlags.InvokeMethod, Private static object InvokeSetMember(this Type type, string methodName, object targetInstance, params object arguments)īindingFlags.Public | BindingFlags.Instance | BindingFlags.SetProperty, Return Path.Combine(.StartupPath, linkFileName) ShortcutType.InvokeMethod("Save", shortcut) ShortcutType.InvokeSetMember("IconLocation", shortcut, iconLocation) ShortcutType.InvokeSetMember("Description", shortcut, description) ShortcutType.InvokeSetMember("WindowStyle", shortcut, shortcutWindowStyle) ShortcutType.InvokeSetMember("Hotkey", shortcut, hotkey) ShortcutType.InvokeSetMember("Arguments", shortcut, arguments) ShortcutType.InvokeSetMember("WorkingDirectory", shortcut, workingDirectory) ShortcutType.InvokeSetMember("TargetPath", shortcut, targetPath) Object shortcut = shellType.InvokeMethod("CreateShortcut", shell, linkFileName) Object shell = Activator.CreateInstance(shellType) Shortcut.WindowStyle = shortcutWindowStyle Shortcut.WorkingDirectory = workingDirectory Type shellType = Type.GetTypeFromProgID(WSCRIPT_SHELL_NAME) ĭynamic shell = Activator.CreateInstance(shellType) ĭynamic shortcut = shell.CreateShortcut(linkFileName) String FullName ", targetPath, iconNumber) Private static object m_shell = Activator.CreateInstance(m_type) Private static Type m_type = Type.GetTypeFromProgID("WScript.Shell") Without additional reference: using System Void SetRelativePath( string pszPathRel, int dwReserved) Void SetIconLocation( string pszIconPath, int iIcon) Void GetIconLocation( StringBuilder pszIconPath, int cchIconPath, out int piIcon) Void GetArguments( StringBuilder pszArgs, int cchMaxPath) Void SetWorkingDirectory( string pszDir)

Void GetWorkingDirectory( StringBuilder pszDir, int cchMaxPath) Void GetDescription( StringBuilder pszName, int cchMaxName) Void GetPath( StringBuilder pszFile, int cchMaxPath, out IntPtr pfd, int fFlags) String desktopPath = Environment.GetFolderPath() įile.Save(Path.Combine(desktopPath, "MyLink.lnk"), false) IShellLink link = (IShellLink)new ShellLink()
#HOW TO CREATE A SHORTCUT ON DESKTOP FOR WEBSITE WINDOWS 10 CODE#
Here is a piece of code that has no dependency on an external COM object (WSH), and supports 32-bit and 64-bit programs: using System Here is an article that goes into detail what you need to do it, as well as sample code. If you want to use some API specific functions then you will want to use the IShellLink interface as well as the IPersistFile interface (through COM interop). Using (StreamWriter writer = new StreamWriter(deskDir + "\\" + linkName + ".url"))Īpplication shortcut private void appShortcutToDesktop(string linkName) String deskDir = Environment.GetFolderPath() URL shortcut private void urlShortcutToDesktop(string linkName, string linkUrl)
