Batch Files to Open and Close Flight Simulator

Opening and closing the various files and ancillary programs to operate a flight simulator can be onerous and time consuming.  While there have been several programs released that enable you to launch flight simulator with a press of a key, they seldom work with complicated platforms such as flight decks. 

One of the most commonly used methods to open files and programs is to use the start menu within Windows.  However, this is not without it’s shortcomings, and specialist knowledge is required.  An easy and trouble free approach is to use batch files.

What is a Batch File

A batch file is a script file that stores commands to be executed in a serial order.  It helps automate routine tasks without requiring user input or intervention. Some common applications of batch files include loading programs, running multiple processes or performing repetitive actions in a sequence in the system.

Also known as a batch job, a batch file is a text file created in Notepad or some other text editor.  A batch file bundles or packages a set of commands into a single file in serial order.  Without a batch file these commands would have to be presented one at a time to the system from a keyboard.

Usually, a batch file is created for command sequences when a user has a repetitive need.  A command-line interpreter takes the file as an input and executes the commands in the given order.  A batch file eliminates the need to retype commands, which saves the user time and helps to avoid mistakes.  It is also useful to simplify complex processes.

Windows usually uses the .bat extension for batch files.

Whilst there are several methods that can be used to write a batch file, I have found that the examples below operate flawlessly.

Writing a Batch File

It's a simple process to write a batch file. 

Prior to beginning, it’s wise to think about the order you want the programs to open, and whether you want a pause between opening particular files and programs.  While a pause is probably not necessary, it’s a good idea as it allows a file or program to complete its opening sequence, prior to the next file or program opening.

When you have completed writing the batch file in notepad save the file with a .bat extension.  To test the batch file double click on the saved .bat extension.

Although others will disagree, I always open the MSFS-2020 or P3d and allow the program to settle before opening any batch file or other programs.

The following examples of batch files are user-specific.  You will need to substitute the file structure with the file structure you are using.

Opening Files and Programs

  • An example of a batch file to open the main flight simulator computer (server).

@Echo  off

//Alpha Main Server Computer (ALPHA-SERVER-P3)  - 09:38 - 25/08/2023

//ProSim738 V3

//ProSim Ancillary Programs

start /d "D:\Flight Simulator Files\SimStacks October 2021\SimStackSwitchv702" Switch.jar

Timeout 0.5

start /d "D:\Flight Simulator Files\FS Set Volume" FSSetvol.exe

Timeout 0.5

start /d "D:\Flight Simulator Files\SimSounds 4.0" SimSounds.exe

Timeout 1

start /d "D:\REX WeatherForce.exe

//ProSim Main Programs

start /d "D:\Flight Simulator Files\ProSim738 V3\ProSimAudio" ProsimAudio.exe

Timeout 1

start /d "D:\Flight Simulator Files\ProSim738 V3\ProSimB738" ProSimB738.exe

An example of a batch file to open the avionics suite on the second computer (client 1).

@Echo off

//Client 1 - ProSim-AR B738 Avionics Suite V3    14:07 5/09/20

//PS738 V3

//Ancillary Programs

start /d "C:\Users\user name\Documents\FSF\Programs\MSFS WideFS7" kilo

start /d "C:\Users\user name\Documents\FSF\Programs\Landing Rate Monitor" LRM.exe

start /d "C:\Users\user name\Documents\FSF\Programs\SimSounds 4.0" SimSounds.exe

//Hardware Connector

start /d "C:\Users\user name\Documents\FSF\ProSim738 V3\ProSimB738-HardwareConnector" ProSimB738-HardwareConnector.exe

//ProSim737 Displays and Indicators

start /d "C:\Users\user name\Documents\FSF\ProSim738 V3\Displays\CAPT PFD" ProsimDisplay.exe

start /d "C:\Users\user name\Documents\FSF\ProSim738 V3\Displays\CAPT ND" ProsimDisplay.exe

start /d "C:\Users\user name\Documents\FSF\ProSim738 V3\Displays\FO PFD" ProsimDisplay.exe

start /d "C:\Users\user name\Documents\FSF\ProSim738 V3\Displays\FO ND" ProsimDisplay.ex

start /d "C:\Users\user name\Documents\FSF\ProSim738 V3\Displays\EICAS" ProsimDisplay.exe

start /d "C:\Users\user name\Documents\FSF\ProSim738 V3\Displays\FLAPS" ProsimDisplay.exe

start /d "C:\Users\user name\Documents\FSF\ProSim738 V3\PS738ChronoCaptain" ProsimDisplay.exe

Timeout 3

start /d "C:\Users\user name\Documents\FSF\ProSim738 V3\ProSimIOS" ProSimIOS.exe

Closing Files and Programs

Likewise, you can also use a batch file to close files and programs sequentially or simultaneously (kill all).

An example of a batch file used to close programs on the main flight simulation computer (server).

@Echo off

//Alpha Main Server Computer (ALPHA-SERVER-P3)  - 09:38 - 25/08/2023

//ProSim738 V3 – closure batch

taskkill /IM wideclient.exe

Timeout  2

taskkill /IM ProSimAudio.exe

Timeout  1

taskkill /IM PMSounds.exe

Timeout 1

taskkill /IM Prosim737.exe

Timeout  4

taskkill /IM fs2020.exe

  • im specifies the image name of the process to be terminated (for example, PMSounds.exe or ProSim737.exe).

  • @echo on/off defines whether a name or message will be displayed on the console.  It’s also used for other tasks such a script troubleshooting.  I have used it in my batch files because I was told it was a good idea to do so, but if you don’t use the @echo command the batch file still works.  If you do use the @echo command I recommend you use @echo off as this will turn off this feature.

  • The // syntax is used to stop the line from being read by the batch file. 

In the examples, the Taskkill command has been used to close the programs.  Taskkill will cause the program to terminate gracefully, asking for confirmation if there are unsaved changes.

To forcefully kill a process, add the /F option to the command line. Be careful with the /F option as it will terminate all matching processes without confirmation.

An example using the /F command is: Taskkill /F /IM ProSimAudio.exe.

There is debate in the computer community to the validity of closing files and programs simultaneously, as ‘killing a program’ may not allow the program enough time to save information it may be saving during the closure process.

For this reason, I'm hesitant to close flight simulator (or other programs) using a closure batch file without a timeout or delay sequence.  Needless to say, it's an easy process to configure a time delay into a batch file to create a delay before closing each program.

Timeouts

Depending upon your computer specifications, some programs may open and close at differing speeds.  If you want a program is open or close before the next program, then a delay sequence will need to be timed into your batch file. 

The timeout command is used to trigger a delay between the programs, enabling any read/write requirements to occur prior to the next program beginning it closure routine.  The numeral denotes seconds or part thereof. 

Streamlining

Once you have created and saved the batch file, a suggestion is to create a shortcut to the file.  Doing this will enable you to make changes to the batch file such as how the file is executed (minimised or maximised), the position on the screen, colour and font style used, and whether to use an icon for easy identification.  Additionally, by creating a shortcut it enables you to place the shortcut on your task bar.

To create a shortcut, right click the batch file and save as a shortcut.

Using Batch Files and ProSim IOS

ProSim-TS IOS screen in opened to network page.  Rather than explain everything, copy the details and use trial and error to achieve your desired result

If you are using multiple computers, you may want to use the ProSim Instructor Operator Station (IOS) to trigger the opening or closure of programs (via the batch file).  When IOS is configured correctly, you will be able to open and close a batch file on one or more networked computers from one computer screen.

To configure IOS, open the network tab, select add a new action or type and select start program.  In the path to executable file on client box type the file address of the batch opening file.  Choose the start option you prefer and ensure that enabled in checked.

To close your programs, open a second action and type in to the path to executable on client box the file address of the batch closure file.

The accompanying image should be self explanatory.

There are other ways to do this, however, this method is probably the simplest.

Caveat

I am not computer technician.  I have used batch files similar to the examples shown for many years without issues.

Final Call

Batch files are but one way to minimise workload and automate the opening and closure of ancillary programs that are used with flight simulator.  The use of IOS to trigger batch files also enables the user to open and close ancillary programs from the one computer screen (instructor station).

Batch Files & Flight-1 Program Launcher - Time Savers

Using Flight Simulator from a flight deck is not as straightforward as many may believe.  Before a flight can commence several programs must be started on two or more computers.  These programs include, but are not limited to; Flight Simulator, ProSim737 (main module, MCP, audio, instructor station, CDU & display modules), FSRAAS, Electronic Flight Bag, WideFS, PM Sounds and so on... 

Although it's not exceptionally time consuming, it does become tiresome using the mouse to activate each program, even if you have shortcuts established on the Microsoft shortcut bar. 

There are numerous methods that can be used to open programs: FSUIPC, WideFS, add on programs such as Flight-1, or a batch file.  However, many virtual pilots lack the necessary skills or confidence to successfully interpret FSUIPC or write a batch file that works the way it's supposed to.

Flight-1 Program Launcher user interface

Flight-1 Program Launcher

Flight-1 Program Launcher is a very easy program that makes starting a flight session exceptionally easy.  In two mouse clicks you can have ALL the required programs opened and ready to use.

Simplicity

The program is standalone, meaning it can reside anywhere on your computer system and does not install into the flight simulator folder directory.  The program interface is very easy to use.

After installation you need to create a list of programs you want the launcher to open.  To do this you click the browse button on the launcher's interface and search for the executable file (.exe) of the target program, and add it to the list and save. 

The Flight-1 Launcher only opens programs, it does not close them

You can select which program starts first, second and so forth....  When you save your preferences a small autostart.cfg file is created in the Flight-1 program folder; this is your preference list (example at left).

Flight-1 launcher - works out of the box

I've been using this nifty program for a few weeks now and have had no issues what-so-ever with it.  It works "out of the box" as designed, and best of all it's shareware!

Flight-1 Program launcher is a free add on available at Flight-1 website.

Writing Your Own Batch File

It's a simple process to bypass the above-mentioned program and write your own batch file.  If you write your own batch file you can also include a batch that closes the programs in addition to opening them.  I've outlined how to make a batch file to close programs.  The same can be done for opening programs but, with different syntax.

  1. Open Notepad ad the editor. Go to "Start" and click on "Accessories." Select "Notepad" from the menu.

  2. Find the file names of the programs you want to close. With the programs running that you want to close, right-click on the task bar and click the "Task Manager" option. Select the "Processes" tab to view a list of file names that are currently running.

  3. Use the "taskkill" command (or whatever command you wish) along with the file names you got from Task Manager. Write a separate command for each file you want to close. Each command line should look like the following example: taskkill /im filename.exe. If one of the programs you are closing is Firefox, the command line would read: taskkill /im firefox.exe.

  4. Save your new application as a .BAT file. Select "Save As" and manually type ".BAT" at the end of the file name you gave to the batch file you just created.

  5. Run the batch file. Double-click on the new application to run it. All the programs you included in the batch file should shut down properly.

A shortcut can then be made to the created file and placed into your shortcut folder.  To edit the batch file, right click the file and select edit.

The syntax required to ensure a batch file works correctly can vary between computer operating systems and your requirements.  I'd recommend a quick search on the Internet to determine the best syntax to use (Google "how to write a opening batch file").

A benefit of using a batch file is that you have to only click one button with your mouse to open or close all the programs required to operate Flight Simulator.

A typical batch file used to open programs is outlined below.  This batch file refers to the main flight simulator computer.

  • @Echo off

  • Echo. Loading software.  ALPHA MAIN COMPUTER (alpha is the name of the computer)

  • start /d "C:\pmSounds" pmSounds.exe

  • TIMEOUT 2

  • start /d "C:\Pro Sim\ProSim737" Prosim737.exe

  • TIMEOUT 9

  • start /d "C:\Pro Sim\ProSimMCP" ProsimMCP.exe

  • TIMEOUT 7

  • start /d "C:\Pro Sim\ProSimAudio" ProsimAudio.exe

  • TIMEOUT 3

  • start /d "C:\FsRaas20" FsRaas20.exe

  • TIMEOUT 2

  • start /d "C:\LOLA" LoLa17.exe

  • TIMEOUT 3

  • start /d "C:\FS10" fsx.exe

Another method of writing the above batch file is outlined below - although the syntax between the batch files is different the outcome is identical.

  • @Echo off

  • Echo. Loading software.  ALPHA MAIN COMPUTER

  • ping -n 2 127.0.0.1 >nul

  • start /d "C:\pmSounds" pmSounds.exe

  • ping -n 2 127.0.0.1 >nul

  • start /d "C:\Pro Sim\ProSim737" Prosim737.exe

  • ping -n 4 127.0.0.1 >nul

  • start /d "C:\Pro Sim\ProSimMCP" ProsimMCP.exe

  • ping -n 2 127.0.0.1 >nul

  • start /d "C:\Pro Sim\ProSimAudio" ProsimAudio.exe

  • ping -n 2 127.0.0.1 >nul

  • start /d "C:\FsRaas20" FsRaas20.exe

  • ping -n 2 127.0.0.1 >nul

  • start /d "C:\LOLA" LoLa17.exe

  • ping -n 2 127.0.0.1 >nul

  • start /d "C:\FS10" fsx.exe

The numeral after TIMEOUT and png -n relates to the number of seconds that must pass before the next program opens. 

For those that are curious, @Echooff triggers a command to prevent the command text from being visible on the screen when the batch file is executed.

Closing Programs - Batch Closure File

The best method to close your simulation dependent programs is to create a closure batch file that closes each program sequentially.

Although it's a simple task to closes programs simultaneously (end processes in Windows Task Manager), there is debate in the computer community to whether killing a program straight-out is a good idea; one school of thought suggests that killing several programs simultaneous may cause problems, if a program is writing files to its file structure and not enough time is allowed for this to be completed.

For this reason, I'm hesitant to close Flight Simulator (or other programs) using a closure batch file without a timeout or delay sequence.  Needless to say, it's an easy process to configure a time delay into a batch file to create a delay before closing each program.

Time-outs

Depending upon your computer specifications some programs may open and close at differing speeds.  If you want to ensure that a program is opened or closed before the next program, then a delay sequence will need to be timed into your batch file.  There are several ways to do this and the syntax varies. 

Below is a typical batch file used to close programs on the main flight simulator computer or server.

  • @Echo off

  • Echo. Closing software.  ALPHA MAIN COMPUTER

  • taskkill /im PMSounds.exe

  • TIMEOUT 3

  • taskkill /im wideclient.exe

  • TIMEOUT 5

  • taskkill /im ProSimAudio.exe

  • TIMEOUT 3

  • taskkill /im ProsimMCP.exe

  • TIMEOUT 5

  • taskkill /im Prosim737.exe

  • TIMEOUT 10

  • taskkill /im FsRaas20.exe

  • TIMEOUT 5

  • taskkill /im LoLa17.exe

  • TIMEOUT 5

  • taskkill /im FSRealTime.exe

  • TIMEOUT 2

  • taskkill /im fsx.exe

The timeout command is used to trigger a delay between the closure of the programs, ensuring that any read/write requirements are able to occur before the next program closes.  The numeral denotes seconds.  The timeout settings on this file are a little long and probably should be shortened.

IM specifies the image name of the process to be terminated.  For example, PMSounds.exe

You will note I've used Taskkill to close the programs.  Taskkill will cause the program to terminate gracefully (1), asking for confirmation if there are unsaved changes. To forcefully kill the same process, add the /F option to the command line. Be careful with the /F option as it will terminate all processes without confirmation or saving of data.

(1)  Information regarding Taskkill obtained from several Internet resources.

I am NOT a computer technician.  The batch files I created for my simulator set-up have worked flawlessly and I am confident, with the correct syntax for your system, they will also work for you. 

If you are like me and tire of opening and closing several programs with a mouse, then try a batch file, or at the very least download and trial the Flight-1 Program Launcher.