I'm trying to see how to setup a batch file that a user would run from an application hosted on Citrix XenApp, such that it launches a .exe from their local computer rather than open the application from the remote session.

I was hoping to find a command to use in the batch file so it runs the .exe from the user's local computer, rather than launching it like a remote application, and it would have to recognize the user's computer ID based on their citrix session or where the .bat is being executed from...

Here's what the .bat currently runs:

@echo off 

start "" "c:\program files\internet explorer\iexplore.exe" "http://google.com"

So in our company software, they just go through a menu and select 1 of the options that would run a batchfile like the 1 above, and it would launch the .exe similar to a remote desktop application

Rather than launching IE from the Citrix server C: drive the user is connected to, i want it to launch IE from the user's local C: drive instead. Is there a way to re-write directory as a UNC path to the user's C: drive? The .bat would have to recognize the computername, so i imagine we can store the value for hostname in a variable, then maybe type the directory as a unc path with that value? Something like this is what i have in mind:

   @echo off 
   set computer= hostname

    start "" "\\computer\C$\program files\internet explorer\iexplore.exe" "http://google.com"

I hope this makes sense . I tried testing it by saving the .bat on 1 of the Citrix app servers, then i just went to that directory from my local computer in Explorer and ran it, but when i run it it says it doesn't recognize the path/doesn't support UNC paths...It does display my computer name though...


It sounds like you are looking for PSEXEC. https://docs.microsoft.com/en-us/sysinternals/downloads/psexec

I use PSEXEC all the time in BAT scripts to restart services, install MSIs, change IIS settings, etc.

Usage is simple:

psexec \\remotemachine CommandToRun commandarguments

For example, one of my regular psexec commands is:

psexec \\RemoteMachineX c:\windows\system32\inetsrv\appcmd recycle apppool /apppool.name:DefaultAppPool

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.