Export (0) Print
Expand All

Creating a Shortcut File (Compact 2013)

3/26/2014

A shortcut or link (.lnk) file provides 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 .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. You can modify this behavior by replacing the shortcut module 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

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 of the Windows directory.

  1. In Visual Studio with Platform Builder, click the File menu, click New, and then click File. The New File dialog box appears.

  2. In the Templates pane, select Text File, and then click Open. A new text file is created and opened.

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

  4. On the File menu, click 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, navigate to %_PROJECTOAKROOT%\Files and click 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 (.bib) File.

  • Open Project.bib and add the following line of code to 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.

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

Show:
© 2015 Microsoft