Reputation: 9393
@echo off
start /wait notepad
start worpad
This is the code i have written in a batch file. My aim is to stop the batch file execution till the notepad application gets closed. Its working perfect but the thing is, Its displaying the command prompt also .Its opening the command prompt when i execute
start /wait notepad in my batch file.
The command prompt gets closed when i close my notepad. But i dont want the command prompt.How do i make that. I even tried these
cmd /c start /wait notepad
even the above command is not working. How do i make it.How do i open only notepad without the command prompt and wait till it is closed ?
Upvotes: 1
Views: 8852
Reputation: 731
Or maybe you can just use the
ping localhost -n ( your time in second ) >nul
So your code will be like this
@echo off
start notepad
ping localhost -n ( your time in second ) >nul
start worpad
Upvotes: 0
Reputation: 77657
As I said in my answer to one of your previous questions, the command prompt window is there because it is the tool that processes the batch file. The command prompt window is the working window of the CMD.EXE
program, just like Notepad's working window is the one where you are editing text files. Typically, running a program with its working window hidden is a non-trivial task, unless the program has a pre-defined mode of running with the hidden window. As it happens, CMD
does not have such a mode.
However, there is a way of starting a program with its window minimised. You only need to create a shortcut to your program (it can be a batch file too), then open the shortcut's properties, and on the Shortcut tab, set the Run property to Minimized
. To make it clearer, here's an illustration:
Upvotes: 1