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.

11
  • 6
    Why use cmd.exe instead of just starting Photoshop directly, if you don't want CMD in the first place?
    – CarlF
    Sep 21, 2010 at 16:02
  • Try cmd.exe /q /c [command]
    – qroberts
    Sep 21, 2010 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, 2010 at 16:29
  • 4
    No need to get upset over it. Also, the questioner is a female, not male.
    – qroberts
    Sep 21, 2010 at 17:35
  • 1
    CMDOW supposedly does this.
    – CGA
    Sep 21, 2010 at 18:51

9 Answers 9

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"
4
  • 4
    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, 2010 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, 2010 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, 2010 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, 2010 at 20:53
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.

4
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.

4
  • Quiet seems to run on Windows NT up to XP. Doesn't say anything about Windows 10. Do you think it might be safe to use it on Windows 10?
    – Henrik
    Apr 28, 2018 at 22:46
  • @Henrik what do you mean 'safe'? It won't break it. There's no harm in trying!
    – barlop
    Apr 28, 2018 at 23:11
  • @Henrik I won't do any harm, try it.
    – Mostafa
    Jul 4, 2018 at 7:09
  • It doesn't work in Win10, just tried it. It does nothing. Dec 20, 2019 at 19:37
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.

2
  • This doesn't work. It gives an error message "The system cannot find the file %*"
    – DavidPostill
    Jul 8, 2015 at 16:44
  • Works without the %* part.
    – Jin Kwon
    Dec 4, 2016 at 12:55
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)

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.

3
  • I read somewhere else that you can do this using start, but just be aware that you can't use this method if you want to make registry entry via commandline; haven't tested it, but that's what the comments say here: stackoverflow.com/a/45560043/1038866
    – bgmCoder
    Nov 28, 2020 at 15:38
  • @bgmCoder: you mean add key/value to registry from cmd?
    – Zimba
    Nov 30, 2020 at 14:53
  • Yes, that's what I mean. I haven't tested it though. I thought just to mention it so it doesn't cause anyone trouble. It's not terribly relevant to the original question since they are just launching programs, but if someone tries it for reg work, they might have a problem.
    – bgmCoder
    Nov 30, 2020 at 15:30
0

Why not use this?

cmd /c start "C://Program Files/Adobe/Adobe Photoshop CS4/Photoshop.exe exit"
2
  • 1
    Can you explain this answer in more detail?
    – bwDraco
    Jul 8, 2015 at 17:48
  • After trying everything else, only this helped. Thanks. #include <windows.h> int main() { system("cmd /c start C:/WINDOWS/system32/notepad.exe"); }
    – James Koss
    Jun 19, 2019 at 1:46
-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...

1
  • Why do you mention Windows 10. The user was using Windows XP. Have you at least verified this works on Windows XP?
    – Ramhound
    Sep 2, 2015 at 18:43

You must log in to answer this question.