Brandon's Notepad

July 30, 2010

Programmatically Creating Windows Shortcuts

Filed under: Computer Software,How-To,Windows — Brandon @ 7:50 am
Tags: , , , , , ,

Home > My Lists > Technical Notes > Programmatically Creating Windows Shortcuts


Windows shortcut files can be created using a script. This is useful in circumstances when you need to distribute shortcuts across multiple computers, possible as part of a software installation procedure. The shortcuts themselves seem to be fairly portable, but this is a more pure way of controlling their content.


My Shell Example

I do a lot of work from the command line, so I take advantage of tried-and-true DOSKEY macros and other useful tools. I like to have these loaded for me whenever I open a new command prompt, so I maintain a shortcut that runs a batch file similar to the .login or .cshrc files used on Unix platforms prior to displaying the prompt. This is the pruned version of the script I use to maintain this shortcut definition:

Shell = new ActiveXObject(“WScript.Shell”);
link = Shell.CreateShortcut(“MyShell.lnk”);
link.TargetPath =”%SystemRoot%\\system32\\cmd.exe”;
link.Arguments = “/K %HOMEDRIVE%\dosrc.bat”;
link.WorkingDirectory = “%HOMEDRIVE%” + “%HOMEPATH%”;
link.IconLocation = “%SystemRoot%\\system32\\progman.exe,6”;
link.Description = “MyShell shortcut by B Brinkley”;

This is based on the example provided in the MSDN article linked above. The arguments are specific to cmd.exe, I rely heavily on environment variables for path info, and the icon is the long-standing MS-DOS logo with the interlocking letters.

November 19, 2009

Windows Keyboard Shortcuts

Filed under: Windows — Brandon @ 10:24 pm
Tags: , , , ,

Here are a few Windows keyboard shortcuts (also called “hotkeys”) that I find very useful. The well-known editing shortcuts have been omitted (e.g. CTRL+X to cut, etc.).

Windows Tools
WINDOWS+D: Show Desktop
WINDOWS+L: Lock workstation
WINDOWS+E: Open Windows Explorer (My Computer)
CTRL+SHIFT+ESC: Task Manager
CTRL+ALT+DEL: Security Manager

Opening Menus
CTRL+ESC: Start menu (same as WINDOWS key)
ALT+ENTER: Open properties menu
ALT+SPACE: Open system menu
SHIFT+F10: Open context menu (same as App key)

Switching Applications
ALT+TAB: Switch apps using “CoolSwitch” dialogue box
ALT+ESC: Switch apps in order opened
WINDOWS+TAB: Navigate apps on taskbar
[Add SHIFT to any of these to reverse direction]

CTRL-F6: Switch docs (e.g. Excel books)
F6: Cycles screen elements
F10: Activates menu bar
[F6, F10 & ALT expose shortcuts in Office 2007]

Moving a Window Using the Keyboard
On various occasions, I’ve had to retrieve a window that was outside of the visible boundries of the desktop. This happened most recently at work, when I logged into a computer with only one monitor attached. At my desktop, the app usually opens by default on the second monitor. To solve this:

  1. ALT+TAB until the app is in focus.
  2. ALT+SPACE to activate the system menu.
  3. Type the ‘M’ botton for ‘Move’.
  4. Use the arrow keys to move the window around.


Blog at