Creating a Shortcut File

Other versions of this page are also available for the following:

Windows Mobile Not SupportedWindows Embedded CE Supported

8/28/2008

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 Visual Studio with Platform Builder, choose New and then File.

    The New File dialog appears

  2. In the Templates pane, select Text File and then choose Open.

    A new text file is created and opened.

  3. 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
    
  4. From the File menu, choose Save As.

  5. 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

See Also

Other Resources

Modifying an OS Design