29

I use below code in Run dialog of Windows XP.

cmd /c "C://Program Files/Adobe/Adobe Photoshop CS4/Photoshop.exe"

You may replace the program path any program installed on your system. The problem is Photoshop launches up but cmd.exe window still keeps. I do not want to cmd.exe file pop up. Is it possible to launch up a program via cmd without opening a cmd.exe window? I need cmd work silently. BTW, I need this code for a program. So I need to start the program via cmd but without cmd.exe window popping up.

Further Comments

Because I will use that code in a program. Program can initiate the cmd exe. But the problem is we do not know which version of Photoshop installed. So it can be Photoshop CS4 or Photoshop CS5. Normally when you type below code in Run you get the Photoshop no matter which is installed.

photoshop

So I want to initiate the Photoshop with this method. Program will initiate cmd as Run above but something like below:

cmd /c photoshop

But it does not work. And even the cmd window appears up. I want to make the process run silently. Also we should not install any other tool. I want a solution that will work on a default Windows.

BinaryMisfit
  • 20,879

9 Answers9

26

The problem is that the Command Prompt (cmd) cannot terminate - it is stuck up there on the screen waiting for Photoshop to terminate.

To launch Photoshop in a bat file and let the batch file continue on and terminate, use the start command, which starts a specified program or command in a separate window.

For example:

start "" "C:\Program Files\Adobe\Adobe Photoshop CS4\Photoshop.exe"
harrymc
  • 498,455
6

HSTART http://www.ntwind.com/software/utilities/hstart.html

You can do

  • start ... run
  • c:\hstart\hstart.exe /NOCONSOLE "cmd /c "c:\program files\microsoft office\office11\winword.exe""

or create an icon.

Some use it to run bat files.. (others do so from a vbs which can also run it with cmd.exe and hide the command window)..but you can use hstart.

I do echo others though, in since you are running an EXE, if you do start..run..pathofexe or make an icon for it, a command prompt won't launch. So why do you want to start it from cmd.exe ?

Also, note.. in dos and windows you use backslashes in directory paths. Forward slashes are for URLs or directory paths in unix or linux.

Ross Rogers
  • 4,807
barlop
  • 25,198
3

The best option is to ask what you are trying to do. If you require the 'code' for a program, why don't you use Shell execute?

And I can't imagine what legitimate work flow would require command line to be called, which in turn would run an executable.

2

There is a tool called Quiet that you can use to accomplish this. Simply pass your .exe or .bat file to it as an argument. For this, simply create a shortcut of cmd command prompt in your desktop. Then get properties of the command prompt shortcut that you've made. Afterwards, in the "Shortcut" tab, fill in the "Target" field like this:

[pathToQuiet.exe] [pathToThe(.exe)/(.bat)file]

If you double click the shortcut, your process will be launched and you can check that through your process list, in task manager.

Note that there shouldn't be any white space in the path to both Quiet.exe and your .exe or .bat file.

Mostafa
  • 29
2
cmd /c "C://Program Files/Adobe/Adobe Photoshop CS4/Photoshop.exe" %*

• the [path]\name of your executable.
• all the other arguments needed by your script (%*) - Just to execute the exe in the background.

Kunal
  • 1,899
1

From Win CMD:

start /b cmd /c "C://Program Files/Adobe/Adobe Photoshop CS4/Photoshop.exe"

Runs program without console window, leaving parent window unblocked so don't have to wait for program (Photoshop.exe) to finish.

Zimba
  • 1,291
1

If you want to run a command and then exit the prompt immediately, you can do this...

cmd /c "C://Program Files/Adobe/Adobe Photoshop CS4/Photoshop.exe" && exit

http://www.thewindowsclub.com/command-prompt-tricks-windows (See run multiple commands sections)

0

Why not use this?

cmd /c start "C://Program Files/Adobe/Adobe Photoshop CS4/Photoshop.exe exit"
Excellll
  • 12,847
Bats92
  • 11
-2

I finally figured out a way that at least in windows 10 appears to hide/close the cmd windows in a shortcut I've been trying to find a solution for. Here is what I use to open Active Directory Users and Computers via runas with another domain login.

runas.exe /savecred /user:domain\username "cmd /c start mmc C:\Windows\System32\dsa.msc"

perhaps "cmd /c start" is a easy solution...