Open something with CMD but not have the CMD window remain

Use the following to open something with CMD on windows, but not have the window remain:

cmd /C start "" "program.exe"

Substitute program.exe with the path to the program you wish to invoke.


This was my use case:

override run
runas=currentuser
run cmd /C start "" "DellCommandUpdate.exe"

I wanted to have BigFix be able to open DellCommandUpdate.exe as the current user when they clicked on an offer, but only if they are an Admin. For some reason, using just run didn’t work. Using run cmd /C did work, but when using run cmd /C the command window would stay running behind DellCommandUpdate.exe until DellCommandUpdate.exe was closed, which is not great.

Using run cmd /C start "" "program.exe" invokes CMD, which then invokes another CMD and passes it program.exe which it then invokes, but the 2nd CMD doesn’t stay open which causes it to close, then the other CMD closes, all while the invoked EXE stays running.

In a way you could compare using cmd /c alone as being similar to using the ActionScript wait command, while using start is more similar to the run command.

Reference: http://superuser.com/questions/191149/how-to-execute-cmd-exe-silently

3 Likes

Been looking for how to accomplish this for several hours now.
Thank you, this worked!!