MKSC — Create, modify, or display a shortcut file.

Syntax: (to create or modify a shortcut file)
MKSC linkfile target /A:args /Bx:value /C:comment /D:directory /I:iconfile /J:index /K:key /M:mode /N:flags /U:level /Z

Syntax: (to display shortcut files)
MKSC linkfile /F:fields /N:flags /P /S

linkfilethe shortcut file to create, change, or display
targetthe filename or object that the shortcut points to
/A:argscommand-line arguments to be passed to the target
/Bx:valueset various console properties
/C:commenta descriptive comment
/D:directorythe default directory
/F:fieldsspecify which information to display
/I:iconfilefilename of an .EXE or .DLL file containing an icon
/J:indexnumber of the icon in iconfile to use; 0 = the first
/K:keya hotkey which can be used to launch the shortcut
/M:modethe suggested window mode: Normal, MINimized, or MAXimized
/N:flagsdisable features; flags may include:
C — disable highlight
D — don’t canonicalize directory
E — suppress many error messages (display mode only)
H — don’t search into hidden subdirectories; only useful with /S
I — don’t canonicalize iconfile
J — don’t search into junctions; only useful with /S
T — don’t canonicalize target
Z — don’t search into system subdirectories; only useful with /S
/Ppage output
/Srecurse into subdirectories; only useful when displaying shortcuts
/U:levelthe UAC level: Normal or Elevated
/Zoverwrite read-only files

Quote any argument containing spaces, angle brackets, or other special characters.

This command can be used for three different tasks: to create a new shortcut file, to modify an existing shortcut file, or to dump the contents of shortcut files to standard output.

Create a shortcut file:

You can create a new shortcut to a file or a folder; a TCC command, alias, or batch file; or one of a number of Explorer objects. To create a shortcut, pass a filename for the new shortcut as the first argument, linkfile. The second argument, target, is required when creating a new shortcut; it specifies the file or object that the shortcut will open.

rem  Create a shortcut to the calculator:
mksc "%@shfolder[16]\Calculator.lnk" "%windir\system32\calc.exe" /k:control-alt-=


Other kinds of files are legal too. If the file is a document, Windows will use the registered program to open it. You can even create a shortcut to a directory:

rem  Create a shortcut to the Fonts folder:
mksc "%@shfolder[16]\Fonts.lnk" "%windir\Fonts"


To create a shortcut to an internal command, alias, or batch file, specify "%_cmdspec" as the target. Set args to either /C or /K followed by the desired command. (/C causes TCC to close immediately after running the command; /K keeps it open after the command finishes.) For instance, to create a shortcut which runs the command TIME /S, you might use:

rem  Create a shortcut to run TIME /S command:
mksc "%@shfolder[16]\Sync System Time.lnk" "%_cmdspec" /a:"/c time /s" /m:min


MKSC also recognizes a short list of Explorer objects. You can use any of the following as target:

<Desktop>the desktop
<Computer>the list of drives
<Documents>the default save location for many applications
<Music>the suggested save location for music files
<Pictures>the suggested save location for graphics files
<Video>the suggested save location for video files
<Printers>the list of printers
<Network>Network Neighborhood; LAN locations
<Connections>network interfaces
<Recycle Bin>deleted-but-recoverable files
<Control Panel>Windows configuration utilities
<Recent>list of shortcuts to recently-opened files
<SendTo>Explorer’s list of send-to locations
(This is not a complete list; see Objects Supported for more.)

Note that all of the above must be quoted to protect the angle brackets.

rem  Create a shortcut to My Computer:
mksc "%@shfolder[16]\My Computer.lnk" "<Computer>"

If the target is in angle brackets but is not in the built-in list of objects, MKSC will search for an object with a matching display name in a few predefined locations; see Objects Supported for more information. For example, if you have a printer named “DrizzleJet 9000”, you can create a shortcut to it:

rem  Create a shortcut to my printer:
mksc "%@shfolder[16]\Printer.lnk" "<DrizzleJet 9000>"


The linkfile should normally end in .LNK. If you do not specify an extension, MKSC will supply the extension by default. Directory aliases are supported in linkfile.

Target should name a file, directory, or one of the Explorer objects listed above. Directory aliases are supported, and the filename is automatically canonicalized (“truenamed”) when the shortcut file is created. If the target is not qualified at all — if it has no drive letter or directory — the plugin will search the path for a matching file. You can bypass canonicalization and the path search with /NC, which stores a non-canonical filename; doing this also disables directory aliases in target. Canonicalization will also be skipped if the target begins with a percent sign followed by a letter.


/A:args specifies the command-line arguments for the target program. Different programs support different arguments, and some ignore them altogether. See the program’s documentation for information about its command-line options.

/AX:args works like /AX:, but supports the use of C-style character escapes in the string. If you need problematic characters like double quotes or backquotes in the arguments list, you can use /AX: with escapes like \q or \k. Note that any backslashes in the arguments must be doubled.


/C:comment specifies a descriptive comment to be stored in the shortcut file. Explorer can display this comment in a tooltip when you hover the mouse pointer over the shortcut icon.

/CX:comment works like /C:, but expands C-style character escapes in the comment. If you need a backslash in the comment, you must double it.


/D:directory sets the starting directory for the target program. Some programs use this as a default directory; others ignore it. The directory is canonicalized, and directory aliases are supported. You can use /ND to store a non-canonicalized filename; this will also disable directory aliases in directory. If you give a directory of *, MKSC will choose an appropriate directory based on target: the parent directory if target is a filename, target itself if it names a directory, and nothing if target names an object. If the directory begins with a percent sign followed by a letter, canonicalization will be disabled automatically. If the directory is a ~ or begins with ~\, the tilde will automatically be replaced with the string %USERPROFILE%; this also will disable canonicalization.

/M:mode sets the default window state for the target program. Most programs will honor this option, but a few set their own window size at startup; /M won’t appear to affect these. Mode should be one of Normal, MINimized, or MAXimized; case is not significant, and only the letters shown in uppercase are required.

/K:key specifies a hotkey which can be used to launch the target with a keystroke. The exact requirements for this feature to work don’t seem to be documented anywhere. For best results, I suggest that (1) the shortcut file should be created in the user’s desktop directory; and (2) the hotkey should be in the form Control-Alt-letter, Control-Alt-digit, or Control-Alt-Numdigit. See Hotkeys for a list of the hotkey names supported by this command; note that some of them differ from the names used by KEYSTACK. You can also specify a hotkey of None, which will remove any hotkey associated with the shortcut.

/I:iconfile and /J:index specify the icon which Explorer uses to display the shortcut. When creating a shortcut, you should specify both or neither. When modifying an existing shortcut file, you can use /J:index alone to select a different icon within the same iconfile.

/U:level sets the UAC level for the shortcut; level is either Normal or Elevated (only the first letter is significant). If it’s not specified, the default level is Normal. This option has no effect under Windows XP.


Console properties:

MKSC allows you to set or change many of the console properties stored in a shortcut. Setting console properties for things that don’t run in a console window is possible, but pointless. Console properties options all start with /B.


/BB:n sets the console font’s weight. n is 400 for normal, 700 for bold.

/BF:font set the console font’s name. Quote it if it contains spaces. If font doesn’t match the name of an actual font, or if it isn’t suitable for use in a console window, Windows will substitute some other font at random — generally the ugliest available.

/BG:x,y sets the desired size of the console font. x is the width, and y is the height. If you’re using a TrueType font, the width is not relevant and may be set to 0.

/BB, /BF, and /BG all affect the console font. If you want to set one of them, it’s probably a good idea to set all three.


/BA:n sets the console’s auto-position option. 0 disables auto-positioning; the console window will open at the screen position specified in the “Layout” tab. 1 allows the system to position the window automatically; the coordinates in the “Layout” tab will be ignored.

/BC:n sets the cursor size. n is a percentage, 10 to 100. (This setting does not affect TCC, which sets its own cursor size.)

/BD:n set the console’s default colors. You may specify the new value either as decimal, or hexadecimal with a leading 0x. The usual value is 0x0007, white on black.


/BHn:color lets your redefine the console palette. n is the color index, 0 (black) through 15 (bright white). Color is a W3C color name or an RGB value. You may give a name, or a three- or six-digit hex value preceded by a number sign. For example, you could use either /BH7:ORANGE or /BH7:#FFA500 to redefine ‘white’ as orange.

You can give more than one color name, separated by commas or semicolons, to define multiple consecutive colors. For example, /BH0:#000,#009,#090,#099,#900 would set values for black, blue, green, cyan, and red.


/BI:n sets the console’s insert mode. 0 disables insert (the console defaults to overtype mode); 1 enables it. (This setting does not affect TCC, which has its own default edit mode settings.)

/BO:x,y sets the console window’s starting screen position (its origin). Using this option automatically disables the auto-position option, as if /BA:0 had been specified.

/BP:n set the console’s “popup” colors. You may specify the new value either as decimal, or hexadecimal with a leading 0x. (TCC does not use these colors for anything; CMD.EXE uses them for its command history popup.)

/BQ:n sets the console’s QuickEdit mode. 0 disables QuickEdit, 1 enables it.


/BS:x,y sets the size of the console scrollback buffer. x is the width and y is the height.

/BS also has an optional third argument to set the height of the visible window: /BS:x,y,h. The height h must be between 5 and 100, and not greater than the screen buffer height y. If you do not specify h, the plugin will supply a reasonable value.

Modify a shortcut file:

To modify an existing shortcut file, the syntax is the same, except that the target parameter is optional. You don’t have to specify a target when changing an existing shortcut, and you probably shouldn’t.

Display shortcut files:

To display the contents of shortcut files, specify only a linkfile. It may contain wildcards to dump multiple shortcut files, and you can use /S to recurse into subdirectories. To prevent MKSC from searching into junctions, use /NJ; to skip hidden subdirectories, use /NH; to skip system subdirectories, use /NZ. If linkfile names a directory, all .LNK files in that directory will be shown.

You can use /F:fields to choose which fields to display. Fields is letters:

Tthe link target
Acommand-line arguments
Dstartup directory
Khotkey
Ccomment
Mstart mode
Iicon filename and index
UUAC level (only under Vista and later)
Nnormal (default) fields; short for TADKCMIU
Bconsole screen buffer info, if available
Fconsole font info, if available
Hthe console palette, if available

If no fields are specified, the default is TADKCMIU.


/P causes MKSC to pause after each screenful of data.

mksc /s "%@shfolder[23]"


See also: the @SCINFO function, which returns values from a shortcut file.