Creating a Shortcut File (Windows CE 5.0)

Send Feedback

Developing an Application

Shortcut or link (.lnk) files are very small files that provide a link to another file.

You can use .lnk files to point to files located in the Windows directory. If you do not use .lnk files, you can only give a ROM file a presence in the file system outside of the Windows directory by making a full copy of the ROM file through a file system file.

The following procedure shows how to create a desktop shortcut file. After you create the file, you must add it to your run-time image. Also, you must typically place a copy of the file in the file system outside the Windows directory.

To create a desktop shortcut file

  1. From the File menu in Platform Builder, choose New Project or File.

  2. In the New Project or File dialog box, select the Files tab.

  3. Choose the Text File type.

  4. In the File name box, enter <File Name>.lnk.

    A new file is created and opened.

  5. In <File Name>.lnk, enter the command for the link.

    A .lnk file is a text file that contains the command line for the linked target, which can be enclosed in double quotation marks, along with the length of that command line.

    You can also choose to pass parameters into the linked target. However, this is behavior that can be changed if the shortcut module is replaced in Coredll.dll.

    By default, an .lnk file uses the following format.

    [number of ASCII characters after pound sign allocated to 
    command-line arguments]#[command line] [optional parameters]
    

    For example, to start MyApp.exe and pass two optional parameters into the application, a sample MyApp.lnk file contains the following syntax.

    40#\Windows\MyApp.exe parameter1 parameter2
    
  6. From the File menu, choose Save As.

  7. Save the file in the OAK section of the board support package (BSP) so that it is built into the run-time image.

    To do this, use the Save As dialog box to navigate to %_PROJECTOAKROOT%\Files and choose Save. For more information, see Miscellaneous Environment Variables.

You have created a shortcut file. You can now add the file to the OS by editing your Project.bib file, or by adding it to your OS design's Catalog item tree. For more information, see Binary Image Builder File.

To add a desktop shortcut file to the OS

  • Open Project.bib and add the following line of code in the FILES section:

    MyApp.LNK $(_FLATRELEASEDIR)\MyApp.LNK NK S
    

    In this example, MyApp.LNK is loaded into the NK memory region. The optional S parameter defines the file as a system file.

To add a desktop shortcut file to the Catalog item tree

For general information about how to place your shortcut into your run-time image's file system, see File System File.

For a step-by-step example of how to perform this procedure, see Organizing Files Within a Run-time Image.

See Also

OS Design Configuration Files | File System File | Adding a File to a Run-time Image | Organizing Files Within a Run-time Image

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.