Problem:
Unable to sequence the applications which have .bat shortcuts using App-v Application virtualization. While launching Batch file shortcuts, showing error "Windows Cannot find the C:\Program files (x86)\Java\bin\javaw".
Mostly Java based based applications facing this issues while calling Java in Batch file.
Reason:
Normally App-V applications are virtualized applications which should run under a virtual bubble, kind of run time environment. But during Batch file execution, the Windows Command Prompt (cmd.exe) is is executing native instead of virtual bubble. This is common behavior in App-v while running Batch file shortcuts. So it showing the above error because native command prompt cannot read the path inside the virtual file system.
Solution:
Below steps explaining the easy way to run the .bat file under virtual bubble.
For running the application inside virtual bubble, we need 2 information.
1. "Package ID" and "Version ID" of App-V Package.
2. Path of shortcut Target .bat file.
Step 1:
Find the "Package ID" and "Version ID" of App-V Package.
a) Open "PowerShell" in Client Machine.
b) Execute "Get-AppvClientPackage"
c) Note down the Package ID and Version ID.
Step 2:
Find the Shortcut target path from existing shortcut or from Virtual File system.
In My example, Target path is
"%LOCALAPPDATA%\Microsoft\AppV\Client\Integration\C6C9251D-CAAA-4EE7-A97D-26D87996C6B7\Root\VFS\ProgramFilesX86\Sirsi\JWF\My-Java-App.bat"
Step 3:
Create New Shortcut with below Syntax.
cmd.exe /c <Batch File Path> /appvve:PackageID_VersionID
In My example,
The shortcut target is
cmd.exe /c C:\Users\ctxpoc1\AppData\Local\Microsoft\AppV\Client\Integration\C6C9251D-CAAA-4EE7-A97D-26D87996C6B7\Root\VFS\ProgramFilesX86\MyJavaApp\My-java-app.bat /appvve:c6c9251d-caaa-4ee7-a97d-26d87996c6b7_03e309c5-e1a9-44a7-a0c4-b437b3c40f70
Launch the new shortcut and test the App-v Application functionality.
Note: Double check the shortcut target and the parameters properly if you get error again. There is a chance of manual error while making the shortcut because of path length and many switches.