Skip to content Skip to sidebar Skip to footer

Make Program Open Itself Again and Again in Batch File

winlogo.jpgIn a previous tip, I showed you how to create a batch file to open multiple applications at one time.

That batch file works slap-up if you want the aforementioned applications to always open up at once.

Just, what if you lot take a number of applications that you lot use frequently, and just desire to choose from a listing, a certain combination of applications to open up at the same time?

For instance, you have a book study due and you need to research the material on the Internet. In this example you want to open Microsoft Word and Firefox.

Or, it'southward time to pay the bills, and you need to open up Notepad, Estimator and Microsoft Excel.

batch-file-input2To do this nosotros can create a batch file with a listing of applications. When you run the batch file, a menu will appear that volition accept user input from the command line and open the applications that you choosen (as shown in above screen shot).

To create the batch file, first, you will want to brand a list of applications that y'all use often.

For this example, I volition select six applications (recollect they can be whatsoever amount and type of applications you desire to utilise):

  • Notepad
  • Estimator
  • Microsoft Discussion
  • Microsoft Excel
  • Internet Explorer
  • Firefox

Side by side, find the executable path for each application. This can be accomplished past finding the shortcut of the awarding in the Kickoff Menu and right click on the application icon (brand certain the Shortcut tab is selected).

batch-file-input1

For Microsoft Office Applications, you lot will demand to look in the binder where Office is installed. On my computer, the executable path is:

C:\Program Files\Microsoft Office\Office12 EXCEL.EXE

Notation: Your path may be dissimilar depending on the version of Windows and Part you are using.

For any awarding executable that you can not find, utilise Windows search (in XP and Vista) to help discover the location.

Create The Batch File

Just right click on your desktop and select New \ TextDocument.

Adjacent proper noun the file what ever you lot want and for now, exit the extension as .txt (I have named my file chooseapp.txt).

Open the file that yous created using notepad, so copy and paste the following code. An explanation of the code is listed below:

@echo off
cls
:start
echo.
repeat one. Notepad
repeat 2. Computer
repeat iii. Microsoft Word
echo 4. Microsoft Excel
echo five. Net Explorer
echo 6. Firefox
echo seven. I'm Done
echo.
repeat.
set /p 10=Pick:
IF '%ten%' == '%x%' GOTO Item_%x%

:Item_1
start /MIN /DC:\Windows\System32 notepad.exe
GOTO Outset

:Item_2
offset /MIN /DC:\Windows\System32 calc.exe
GOTO Start

:Item_3
kickoff /MIN /D"C:\Programme Files\Microsoft Office\Office10" WINWORD.EXE
GOTO Outset

:Item_4
get-go /MIN /D"C:\Program Files\Microsoft Part\Office10" EXCEL.EXE
GOTO First

:Item_5
start /MIN /D"C:\Plan Files\Net Explorer\iexplore.exe" http://www.google.com
GOTO Showtime

:Item_6
start /MIN /D"C:\Program Files\Mozilla Firefox" firefox.exe http://world wide web.google.com
GOTO Get-go

:Item_7
exit

Here's How The Batch File Works

– The @repeat off prevents displaying results of the commands at the prompt.

cls – clears the screen

:start – begins the commands to display the list

echo. – creates a bare line

echo i. Notepad
repeat 2. Reckoner
echo 3. Microsoft Give-and-take
echo 4. Microsoft Excel
repeat five. Net Explorer
echo 6. Firefox
echo 7. I'm Done

The to a higher place lines are the applications that will be displayed in the list. Yous should edited these lines with the names of the applications you want displayed.

set /p x=Choice: – set up the variable name x=Selection that is used in the next line

IF '%x%' == '%10%' GOTO Item_%x% – statement that determines what number in the list you lot chose and to go to the line (GOTO) that  will open up the application.

—>>>The above two lines should not be edited<<<—

:Item_1
beginning /MIN /DC:\Windows\System32 notepad.exe
GOTO Commencement

All lines starting with :Item_ and their number (in my example 1 to 6) is where yous enter the path and executable name of the awarding to be opened.

The start command has 2 parts:

MIN will minimize the application when information technology is opened (NOTE: some applications volition ignore this and NOT open minimized).

/DC:\Windows\System32 notepad.exe is where you enter the path and executable name. Yous will demand to edit this parameter with the application you want opened .

GOTO Start – tells the batch file to return to the Start line in the beginning that will permit you to make another option.

:Item_7
leave

The higher up lines ends the batch file when yous select option 7. Depending on the number of applications in YOUR listing, make sure to re-number the listing including the last item that is used to exit the batch file.

When finished, salve the file and don't forget to rename the file (right click on the file and select rename) and apply .bat as the extension.

Fourth dimension To Run The Batch File

To run it, double click on the batch file. A command window will appear allowing you to brand your selections one at a fourth dimension (it will loop) by entering the number next to the word Option, and so pressing the Enter fundamental.

batch-file-input3 Afterwards making your selections, don't forget to select the concluding number in the listing so the batch file volition get out.

If you need to re-edit the batch file, just right click on information technology and select edit (don't double click to edit). Subsequently editing, salve the file before endmost.

As you tin can see, creating this batch file can be a handle little utility to accept around. Information technology can too exist used to not only open applications, but files that you may use frequently (just create some other line in the list and add the path to the file with the file proper noun).

murphycoped1954.blogspot.com

Source: https://www.watchingthenet.com/how-to-create-a-batch-file-that-opens-applications-you-choose-from-a-list.html

إرسال تعليق for "Make Program Open Itself Again and Again in Batch File"