Sometimes people ask me about differencies in Windows Mobile for Smartphone and PocketPC. Hmm, I should say Windows Mobile Standard and Professional. Well, the most significant differences are in UI, and now I know the next one. In Smartphone you are not able to create shortcuts to file on your file system. To be precise you have no option how to create it.

On pocket PC it’s quite easy, just select the file in explorer, tap and click Copy. Then go to the folder where you want to place the shortcut, tap and click Paste Shortcut. Unfortunately Smartphones has no Paste Shortcut option. So, it was only matter of time when someone will ask me how to fix this glitch.

How does shortcut work?

In Windows CE (so Windows Mobile) the shortcut file is very simple plain text file. If you open some *.lnk file in notepad, you will see something like this:

42#"\Program Files\Total Commander\cecmd.exe"

The number 42 is of course Answer to Life, the Universe, and Everything. But in this case it is the length of the command placed in shortcut. So that Program Files\Total Commander\cecmd.exe without the quotes. The quotes are neccesary when the path contains spaces. Don’t think that you can put qoutes everywhere. If the path has no spaces than put no quotes. Like in this example:


The # sign is just the delimiter. In cases you want to pass some arguments to the exacutable, you can add it right after the path. Don’t forget to add length of the parameters to begining number. Following examples shows executing with parameters. First one executes Total Commander and pass \Windows as the parametr. Second one executes autoprof and pass two parameters. Quotes are NOT count to the length.

51#"\Program Files\Total Commander\cecmd.exe" \Windows

27#\Windows\autoprof -s Silent

Do it from C#

The principles mentioned above is obviously very easy to rewrite into the C# code. So here is the method and example how to place short cut to Total Commander into the start menu.

/// <summary>
/// Creates the link file
/// </summary>
/// <param name="destination">Destination of the shortcut</param>
/// <param name="shortCut">Shortcut file name</param>
/// <param name="parameters">Parameters</param>

/// <returns>true if link was created</returns>
private bool CreateLink(string destination, string shortCut, string parameters)
        bool isQuoted = false;

        // when path contains spaces the set quote
        destination = destination.Trim();
        if (destination.IndexOf(' ') > -1) isQuoted = true;

        // count length. +1 for space between path and arguments
        string link = destination;
        int len = destination.Length + parameters.Length + 1;
        // add quotes when neccesary
        if (isQuoted)
            link = """ + link + """;

        // add parametrs if any
        if (parameters != null && parameters.Length > 0)
            link += " " + parameters;
        // write everything into the file
        FileStream fs = new FileStream(shortCut, FileMode.Create, 
                    FileAccess.Write, FileShare.ReadWrite);
        StreamWriter sw = new StreamWriter(fs);
        // Your exception handling here
        return false;

    return true;


CreateLink(@"\Program Files\Total Commander\cecmd.exe", 
        @"\Windows\Start Menu\go windows.lnk", "\Windows");

Complete application

I wrote application called ShortcutMaker as the complete solution for creating shortcuts in smartphones. It is written in C# and uses Compact Framework 1.0, so that it will run without other requirements on WM 2003 and above. Since CF 1.0 has no support for standard file-open and folder-browsing dialogs, I utilize the one from Peter Foot. You can download it from here with examples. Those are now implementeted in OpenNETCF.

Download the instalation cabinet file: