How to Publish an Application Using a Shortcut (.lnk file)

How to Publish an Application Using a Shortcut (.lnk file)

book

Article ID: CTX692985

calendar_today

Updated On:

Description

This article outlines two options for publishing shortcuts in the XenApp environment.


Instructions

Though it is a best practice to publish applications by their executable, there are certain applications (such as legacy DOS and custom applications) where publishing through a shortcut (.lnk file) is required to maintain proper functionality. 

Complete one of the following procedures to publish shortcuts in your XenApp environment:

Method-1

  1. Create the shortcut and modify its properties as necessary.

  2. Create a batch file with the line of code shown by copying the code into Notepad, modifying the path to the absolute path of your shortcut, and saving the file with a .bat extension.

    start c:\app\shortcut.lnk

  3. Publish this batch file normally as you would publish an executable.

Method-2

  1. Create the shortcut and modify its properties as necessary.

  2. Create a Visual Basic Script with the code shown by copying the code into Notepad, modifying the path line to the absolute path of your shortcut, and saving the file with a .vbs extension.

    Note the %comspec% variable with the /c switch.  This effectively opens a command window, launches the application from its shortcut within the command window, and then closes the command window.  As of 6/11/2008, this extra variable was observed to be necessary on servers running Windows Server 2003 or Windows 2000 Server with varying service pack levels, although it was not required when executing the script on Windows XP.

    'AppLaunch.vbsOn Error Resume NextDim sAppPathSet WshShell = WScript.CreateObject("WScript.Shell")' Path to the shortcutsAppPath = "%comspec% /c c:\app\shortcut.lnk"' Executes the program then closes the script.Return = WshShell.Run(sAppPath, 1, false)Wscript.quit
  3. Publish this script using the absolute path to wscript.exe and the absolute path to the VBScript passed as a parameter. For example:

    c:\windows\system32\wscript.exe "c:\AppLaunch.vbs"

    My App - Publish Application

Issue/Introduction

This article outlines two options for publishing shortcuts in the XenApp environment.