I would like to run hostname on a remote machine CLIENT1. If I provide the hostname with a UNC path directly in the psexec command it works fine as you can see below.
psexec \\CLIENT1 -e cmd /c hostname
CLIENT1
cmd exited on CLIENT1 with error code 0.
If I choose to use the @file parameter of psexec to pass in a text file with the hostname, it doesn't run the hostname command. It simply drops me in the cmd on the remote machine and stops executing.
psexec @"c:\temp\hostname.txt" -e cmd /c hostname
I can manually run hostname once I'm in there, but that's not what I'm after.
I either have to exit or Ctrl-C.
I've tried every combination of quotes that I can think of and nothing has worked. Is this a bug? Can anyone reproduce this behavior? I'm running psexec v2.2 on Windows 7 SP1 (both local and remote), but also saw the behavior in psexec v2.11 as well.