App-V - Running a command inside the virtual environment

April 27, 2011

For troubleshooting reasons it sometimes required to run a command or access files in the virtual environment of an App-V package. There are a few methods to access the virtual environment:

  • When sequencing add a shortcut to the required program, for example cmd.exe or regedit.exe;
  • Edit the OSD file to add a prelaunch script;
  • Access the necessary tools from a menu or dialog box from the packaged application if possible.

All of these are quite cumbersome compared the a specific parameter added to the App-V Client 4.x to replace the program specified in the FILENAME= tag inside the cached OSD file.

Sfttray.exe supports the /exe parameter, which launches the program or file that follows the parameter inside virtual environment.

For example:

sfttray /exe cmd.exe "TweetDeck 0.36.2"

The above example start a DOS prompt inside the virtual environment of the TweetDeck application. The versioning information is optional when you only have one version with this name, but the name of the application needs to be exact, including the use of capitals and spaces. You can use the following command to get the correct info:

sftmime query obj:app /short

Back to sfttray: The /exe parameter cannot be used with arguments directly. Instead optional arguments can be passed at the end of the sfttray command line. The parameters at the end of the sfttray command line replace the value of the PARAMETER= tag inside the cache OSD.

For example:

sfttray /exe cmd.exe "TweetDeck" /k PATH

The /k PATH parameters are passed to cmd.exe when it is started inside the virtual environment. The command cmd.exe /k PATH shows the content of the PATH environment variable inside the App-V package.

Another example would be:

sfttray /exe "iexplore" "TweetDeck" http://www.appvirtguru.com

The command line above starts Internet Explorer inside the package and opens the website http://www.appvirtguru.com mentioned as the parameter. This is a practical way of testing plugins and run times.

It is advisable to use absolute paths to the files used for /exe.

More options to start troubleshooting tools and App-V information in general at Aaron Parkers blog: http://blog.stealthpuppy.com/virtualisation/app-v-faq-27-how-do-i-get-an-application-into-the-app-v-bubble-for-troubleshooting/