Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

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

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

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
    
Try cmd.exe /q /c [command] –  qroberts Sep 21 '10 at 16:06
    
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
    
CMDOW supposedly does this. –  CGA Sep 21 '10 at 18:51
show 6 more comments

4 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"
share|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
add comment

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.

share|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
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.