Reputation: 11
In Windows 7 I am trying to open an application on a remote server I do not want to use Powershell nor PSexec. I tried to open Firefox on a remote server using the following code but I receive a ReturnValue = 0
but Firefox never launches.
WMIC.exe /node:ComputerName process call create "cmd.exe /C C:\Program Files\Mozilla Firefox\firefox.exe"
ReturnValue = 0
Upvotes: 0
Views: 3258
Reputation: 24466
The problem with your code is that the spawned cmd
process can't find a program named c:Program
. This is because you haven't quoted to keep the full path as a single token, and you haven't escaped your backslashes.
To fix your existing line, add backslash-escaped quotation marks around the path to Firefox. Also, literal backslashes must be doubled in wmic's WQL arguments.
wmic /node:server process call create "cmd /C \"C:\\Program Files\\Mozilla Firefox\\firefox.exe\""
An even better solution, though, would be to use cmd
's internal start
command to find Firefox within App Paths so you don't have to specify the full path\to\executable.
wmic /node:server process call create "cmd /c start firefox"
Upvotes: 2