How do I start Windows programs from a batch file, please?
Moderator: DosItHelp
How do I start Windows programs from a batch file, please?
First of all, sorry if the answer to this is common knowledge, but I can't get the forum's Search function to look for 'Windows' or 'Start', and I'm unable to find another similar post.
Anyway, I'm trying to write a batch file that, when I click it, will start some Windows programs, i.e.
*************************
c:
cd\
cd "Program Files (x86)\GEEdit2"
"C:\Program Files (x86)\GEEdit2\GoldeneyeSetupEditorV2.exe"
"C:\Program Files (x86)\Mozilla Firefox\firefox.exe"
"C:\Windows\notepad.exe"
**************************
But only the first program starts, and the batch file pauses permanently. I've tried using the START command, but nothing I do will make two consecutive programs start at once, each program will only start when I close the preceding one.
Any help to get the programs all to start at once will be appreciated.
Also, is there a command line argument or something that will negate the need for me to set the cd\ folderto the Goldeneye Editor's folder before starting the .exe (otherwise the program aborts, saying "Cannot find image file"). If not then it's no hardship, having to use the cd\ command, but it does seem like something that would have a
START /[use this folder]
type argument for the command line.
Thanks for any replies.
Anyway, I'm trying to write a batch file that, when I click it, will start some Windows programs, i.e.
*************************
c:
cd\
cd "Program Files (x86)\GEEdit2"
"C:\Program Files (x86)\GEEdit2\GoldeneyeSetupEditorV2.exe"
"C:\Program Files (x86)\Mozilla Firefox\firefox.exe"
"C:\Windows\notepad.exe"
**************************
But only the first program starts, and the batch file pauses permanently. I've tried using the START command, but nothing I do will make two consecutive programs start at once, each program will only start when I close the preceding one.
Any help to get the programs all to start at once will be appreciated.
Also, is there a command line argument or something that will negate the need for me to set the cd\ folderto the Goldeneye Editor's folder before starting the .exe (otherwise the program aborts, saying "Cannot find image file"). If not then it's no hardship, having to use the cd\ command, but it does seem like something that would have a
START /[use this folder]
type argument for the command line.
Thanks for any replies.
Re: How do I start Windows programs from a batch file, please?
start /wait "C:\Program Files (x86)\GEEdit2\GoldeneyeSetupEditorV2.exe"
start /wait "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"
start /wait "C:\Windows\notepad.exe"
![Wink ;)](./images/smilies/icon_wink.gif)
start /wait "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"
start /wait "C:\Windows\notepad.exe"
![Wink ;)](./images/smilies/icon_wink.gif)
Re: How do I start Windows programs from a batch file, please?
Kerr Avon wrote:First of all, sorry if the answer to this is common knowledge, but I can't get the forum's Search function to look for 'Windows' or 'Start', and I'm unable to find another similar post.
I very rarely ever use any websites internal search function unless I know they are using for their search results. I always just use Google.
In a Google search box you can do this.
Code: Select all
Windows start site:dostips.com
Re: How do I start Windows programs from a batch file, please?
zimxavier wrote:start /wait "C:\Program Files (x86)\GEEdit2\GoldeneyeSetupEditorV2.exe"
start /wait "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"
start /wait "C:\Windows\notepad.exe"
Thanks, but that's not working.
When I run it, the block DOS box opens as normal, saying:
****************************
C:\Users\Kerr\Desktop>start /wait "C:\Program Files (x86)\GEEdit2\Goldeney
eSetupEditorV2.exe"
****************************
Then (unlike when I run my original batch file, from the first post in this thread) a grey DOS window opens. It is a command prompt open at the desktop, i.e. it says:
******************************
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\Kerr\Desktop>
*************************
and then nothing happens until I close the grey DOS window, at which point the black DOS box now says:
****************************
C:\Users\Kerr\Desktop>start /wait "C:\Program Files (x86)\GEEdit2\Goldeney
eSetupEditorV2.exe"
^CTerminate Batch Job (Y/N)
****************************
There's no space between the ^C and the T, and I haven't pressed CTRL + C or anything.
If I press y then ENTER then the black Box closes, of course. But if instead I press n and ENTER then another grey DOS Box opens, and if I close that, then if I press n and ENTER then I get another grey DOS box. And if I then close that grey DOS box, and press n and ENTER, then the black box closes and the batch file ends. At no point do any of the programs (The Goldeneye Editor, Firefox, or Notepad) actually start.
I'm running Windows 7, 64 bit, with no problems (that I know of). If I entter ver into a newly opened DOS Box then I get:
Microsoft Windows [Version 6.1.7601]
I've tried to right click the batch file, and change it to Run This Program as Administrator, but that option is greyed out.
NB., when I say ''DOS Box', I do mean just the little DOS window that Windows uses, not the emulator DOS Box, I've not used that here.
Re: How do I start Windows programs from a batch file, please?
Code: Select all
@Echo Off
"C:\Program Files (x86)\GEEdit2\GoldeneyeSetupEditorV2.exe"
"C:\Program Files (x86)\Mozilla Firefox\firefox.exe"
C:\Windows\notepad.exe
Code: Select all
@Echo Off
Start "" "C:\Program Files (x86)\GEEdit2\GoldeneyeSetupEditorV2.exe"
Start "" "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"
Start C:\Windows\notepad.exe
Re: How do I start Windows programs from a batch file, please?
I'm just clarifying the problem here:
You can see the "title" in the help below: there must be a "" or "title" or "some name" when the following commands also use double quotes.
You can see the "title" in the help below: there must be a "" or "title" or "some name" when the following commands also use double quotes.
Code: Select all
c:\Users>start /?
Starts a separate window to run a specified program or command.
START ["title"] [/D path] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]
[/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL]
[/NODE <NUMA node>] [/AFFINITY <hex affinity mask>] [/WAIT] [/B]
[command/program] [parameters]
"title" Title to display in window title bar.
Re: How do I start Windows programs from a batch file, please?
Compo wrote:If you don't want one to open when the last was closed then:Code: Select all
@Echo Off
"C:\Program Files (x86)\GEEdit2\GoldeneyeSetupEditorV2.exe"
"C:\Program Files (x86)\Mozilla Firefox\firefox.exe"
C:\Windows\notepad.exeCode: Select all
@Echo Off
Start "" "C:\Program Files (x86)\GEEdit2\GoldeneyeSetupEditorV2.exe"
Start "" "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"
Start C:\Windows\notepad.exe
That works great! I had to add the CD\ to the Goldeneye Editor folder, otherwise the Editor wouldn't start, instead just giving the image file not found error, but when I added it, so the batch file is:
*****************************
@Echo Off
c:
cd\
cd "Program Files (x86)\GEEdit2"
Start "" "C:\Program Files (x86)\GEEdit2\GoldeneyeSetupEditorV2.exe"
Start "" "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"
Start C:\Windows\notepad.exe
*****************************
then everything works as desired. Thanks everyone for all of the help. And Foxidrive, thanks for the information, I'll remember to use the "" if I need more such batch files.
Re: How do I start Windows programs from a batch file, please?
You will find there is more help in the start /? text.
One switch described in the extra text is to specify a working folder.
Test this to see if I made a mistake in syntax.
In fact firefox.exe is a registered file and notepad doesn't require a path - so this will work too for both of those executables.
One switch described in the extra text is to specify a working folder.
Test this to see if I made a mistake in syntax.
Code: Select all
@echo off
Start "" /d "C:\Program Files (x86)\GEEdit2" "GoldeneyeSetupEditorV2.exe"
Start "" "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"
Start C:\Windows\notepad.exe
In fact firefox.exe is a registered file and notepad doesn't require a path - so this will work too for both of those executables.
Code: Select all
@echo off
Start "" /d "C:\Program Files (x86)\GEEdit2" "GoldeneyeSetupEditorV2.exe"
Start firefox.exe
Start notepad.exe
Re: How do I start Windows programs from a batch file, please?
If they were the real programs to open, technically the known/registered executables don't need the .exe appending either.
e.g.
e.g.
Code: Select all
Start notepad
Re: How do I start Windows programs from a batch file, please?
Good catch compo.