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.

link|improve this question
4  
Why use cmd.exe instead of just starting Photoshop directly, if you don't want CMD in the first place? – CarlF Sep 21 '10 at 16:02
perhaps valentina miswrote .. and wants to start it with a command, and she considers start..run..blah<ENTER> to be a command.. so could do start..run...[pathtophotopshop]<ENTER> Then skip the cmd /c, and it just starts, with no command prompt – barlop Sep 21 '10 at 19:08
I agree...this makes no sense. Could you clarify why you want to do it this way? – Shinrai Sep 21 '10 at 22:22
FYI, OP has posted a response as an answer since she doesn't have comment privileges yet – Lord Torgamus Sep 22 '10 at 20:37
@Lord: You can always post a comment on your own question/answer. – Hello71 Sep 22 '10 at 22:17
show 1 more comment
feedback

migrated from stackoverflow.com Sep 21 '10 at 15:58

This question came from our site for professional and enthusiast programmers.

6 Answers

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"
link|improve this answer
isn't the start command run from a command window? in which case a command window would've popped up. I would think that once in cmd.exe, the only advantage to start, would be that it lets you choose whether you want it minimized or maximized.. but if he doesn't want it there at all.. how would it help? And if using start from cmd.exe then he may as well just type the path of the program without start. – barlop Sep 21 '10 at 19:05
@barlop: Without start, the script is frozen until the program terminates. With start, the script can terminate and disappear. – harrymc Sep 21 '10 at 20:25
out of interest, what do you mean by the script.. do you mean them doing start blah.vbs "c:\....\photoshop.exe" ? and having blah.vbs (a script file) start it? – barlop Sep 21 '10 at 20:49
@barlop: I just meant the old and true bat file, which I assume is what the poster uses. I changed script->bat file. – harrymc Sep 21 '10 at 20:53
feedback

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.

link|improve this answer
Do you know what hstart is doing? How is it hiding the created window? – Ross Rogers Nov 21 '11 at 19:29
1  
@RossRogers I don't know but maybe API Monitor would tell you apimonitor.com and also, vbscript can hide a window too. superuser.com/questions/62525/run-a-completly-hidden-batch-file and that mentions a program called Quiet, from this site joeware.net joeware.net/freetools/tools/quiet/index.htm which mentions that his program uses ShellExecuteEx to do it. – barlop Nov 22 '11 at 3:33
feedback

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.

link|improve this answer
feedback

Try cmd.exe /q /c [command]

link|improve this answer
No that won't work. You try it! Also, it'd be /q /c command if anything cmd /q /c "c:\program files\microsoft office\office11\winword.exe" Notice that the command window pops up. He doesn't want that. If you would've tried it, you would've known that!! – barlop Sep 21 '10 at 16:29
No need to get upset over it. Also, the questioner is a female, not male. – qroberts Sep 21 '10 at 17:35
feedback

CMDOW supposedly does this.

link|improve this answer
feedback

Go to cmd. You can do this by pressing Windows+R and type "cmd", then Enter.

In cmd, type

start %windir%

There, go to File » Create Shortcut. It will ask you what you want the shortcut to go to. Click Browse, and find Photoshop.exe on your computer. Then click Next. Put in a name for your shortcut. I recommend you to type "Photoshop". Then finish.

Close the Windows folder and go to cmd. Then type

start photoshop 

(or whatever you put for the shortcut name in the Windows folder)

Press Enter after you typed start photoshop, and Photoshop will open.

If you want cmd to close afterwards, and you just want to open programs, you can do so by using run instead (i.e. do all of the above and press Windows+R then type in photoshop inside the search bar).

link|improve this answer
feedback

Your Answer

 
or
required, but never shown