Advertisement
mikedopp

Create Shortcut for all users

Feb 5th, 2016
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. First you have to create a small text file by the name mkshortcut.vbs. Use your favorite text editor to edit the file, even notepad will do. Then copy the following text and paste it into the file:
  2.  
  3. set WshShell = WScript.CreateObject("WScript.Shell" )
  4. set oShellLink = WshShell.CreateShortcut(Wscript.Arguments.Named("shortcut") & ".lnk")
  5. oShellLink.TargetPath = Wscript.Arguments.Named("target")
  6. oShellLink.WindowStyle = 1
  7. oShellLink.Save
  8.  
  9. Then save the file and exit the editor. Make sure that you move the file in a directory in your PATH (usually C:WINDOWSSystem32 is fine). Now, from the command line you can create shortcuts this way:
  10.  
  11. mkshortcut /target:TargetName /shortcut:ShortcutName
  12.  
  13. You will have to replace TargetName with the name of the target file and ShortcutName with the name of the shortcut to be created (do not include a .lnk extension!). For example:
  14.  
  15. C:>mkshortcut /target:"c:/documents and settings/giannis/desktop" /shortcut:"My Desktop"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement