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