Click here to Skip to main content
15,562,331 members
Articles / Programming Languages / C#
Posted 12 May 2008

Tagged as


12 bookmarked


Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
12 May 2008CPOL1 min read
A utility to create multiple shell shortcuts from C#


This is a utility that allows you to create multiple shell shortcuts at a time. All you need to do is configure what ever you need in a simple text file and execute the exe.


In our normal day to day work we find many useful tools. But we need to go here and there to execute them. Wouldn't it be nice to have all of them at a single place? This can be accomplished in windows OS, just by right clicking and "send to desktop as a shortcut". Then you can copy/cut paste the shortcut at a place you want. But what if your tools list grows and what if you change your harddisk or system? You have to do all that exercise again. Here is a simple tool that will allow you to do just that work.

This is completely written in C# and uses windows shell RunTime Callable wrapper generated by Visual Studio. The attached code is Visual Studio 2005 solution.

Here is the ScreenShot


Using the Tool

The tool is named - ShellLinkCreator

The shortcuts file name - ShortCuts.txt (please do not rename this, its hardcoded in code)

Editing this shortcuts file is simple.

All lines that start with '#' are comments and the actual lines has the format:

Actual solution or folder path(relative or absolute) , ShortCutName , Description , Working Folder , Folder in which to create the shortcut .

Here is the shortcuts file.

# All the paths can be either relative or absolute
# Lines starting with "#" are comments.
# on each separate line put the file or even folder for which you want to create the shortcut
# each line is one shortcut, options splitted with comma
# Format :: 
# Actual solution or folder path(relative or absolute) , ShortCutName , Description , Working Folder , Folder in which to create the shortcut
# 3rd , 4th and 5th parameters are optional. If the 5th parameter ,  the Folder in which to create the shortcut does not exist ,  it will be created
# If any line has only 1 parameter that will be taken up as a common output path to create the shortcuts.
# so to eliminate any confusion, give the common output folder path as first line.

%WINDIR%\System32\cmd.exe, cmd.exe, command prompt,.,.\My_Windows_ShortCuts\System32
%VS80COMNTOOLS%\errlook.exe, errorlookup.exe, Native error lokkup,%VS80COMNTOOLS%
%VS80COMNTOOLS%\spyxx.exe, spy++.exe, Windows SPY++, %VS80COMNTOOLS%
%VS80COMNTOOLS%\bin\depends.exe, depends.exe, Native dependency walker, %VS80COMNTOOLS%\bin
%VS80COMNTOOLS%\bin\guidgen.exe, GUIDGen.exe, GUID Generator

Actual code to create shortcut

// Here is the C# code

using IWshRuntimeLibrary;   
WshShell aShell = new WshShellClass(); 
IWshShortcut aShortCut = (IWshShortcut)aShell.CreateShortcut (shortcutPath);
aShortCut.TargetPath = ActualPath; 
aShortCut.Description = Description; // optional 
aShortCut.WorkingDirectory = Working Directory; // optional

Points of Interest

This tool can be used in Test Automation where it is required to create the shortcuts. Also this can be useful to the developers who has many solutions or files to work with.


This is my first submission to code project.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Written By
Web Developer
India India
I am Anand, a senior software developer from Bangalore, India. I have 3+ years of programming experience in C,C++,VC++,eVC++,MFC,ATL,COM,C++/CLI,.NET,C# and a bit VB,ASP and WML. I am mostly interested in VC++,C++/CLI. My hobbies are programming, playing chess.

Comments and Discussions

GeneralSome years ago... Pin
ADLER113-May-08 9:32
ADLER113-May-08 9:32 
GeneralPlease give feedback here.... Pin
AnandChavali13-May-08 3:10
AnandChavali13-May-08 3:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.