• How To...Use Batch Files To Turn Routes On And Off

    TrainSim.Com How To: Use Batch Files

    Turning Routes On & Off Using Batch Files

    By Cyndi Richards


    I would like to thank my good friend Otto Wipfel (OTTODAD) for the idea of using batch files. I have only expanded on his original idea by creating a comprehensive step by step guide. In my guides I like to stay with the KISS principle: KEEP IT SIMPLE STUPID! Thus, these batch files are the bare minimums to get you started.

    This step by step will show you how to create batch files to turn your individual routes on or off. The starting portion of MSTS will load up much faster. The length of time you have a black screen before the route selection screen will remain the same. This is when MSTS is loading the engines and wagons.




    Method 1 will allow you to turn individual routes "ON" and "OFF".

    Method 2 will allow you to turn all routes "OFF" at once, and turn "ON" routes individually.*




    Grab a pencil & paper and open the ROUTES folder. Write down the name of the ROUTE exactly as it appears on the folder, including spaces, underscores, etc. Now open the ROUTE folder and look for the file that ends with .trk* . Write down the file name exactly as it appears. Do this for each route in the folder. For MSTS to function properly one route must always be "ON". Scratch your favorite route from the list so it will always be "ON". For this example we will the route USA2, so wherever you see USA2, use the appropriate route folder name or .trk file name.*


    METHOD 1


    1.* Open WordPad, < NotePad in XP >.


    2.* Type:* @ECHO OFF* <ENTER>


    3.* Type:* CLS** <ENTER>


    4.* Type:* C:*** <ENTER> note: if MSTS is installed on a drive other

    ****************************** than "C" then enter drive letter in

    ****************************** place of "C"

    5.* Type:


    **************** <ENTER>*************


    6.* Type:* REN "USA2.OFF" "USA2.TRK"* <ENTER>*******************************


    7.* Type:* CLS* <ENTER>


    8.* At the top of the screen click on FILE, then SAVE AS.


    9.* In the FILE NAME window type:* USA2-ON.BAT


    10. In the SAVE AS TYPE window click on the triangle at the right*

    *** side.


    11. From the drop down menu select and click on,



    12. Save file to location of your choice. When clicking SAVE a window

    *** will pop up with a message about formatting. Just click YES.


    13. Congratulations! You have just created a batch file.

    *** Your original file should still be on the screen.

    *** DO NOT CLOSE IT!

    *** We now have to create a batch file to turn the route "OFF".


    14. Go to the line that begins with REN.


    15. Change "USA2.OFF" to "USA2.TRK" move the cursor to the right and

    *** change "USA2.TRK" to "USA2.OFF". The line should now read:


    *** REN "USA2.TRK" "USA2.OFF"


    *** This is just the opposite of the original text for that line.


    16. Now follow steps 8 through 12. In step 9, name the file

    *** USA2-OFF.BAT


    17. Repeat steps 1 through 16 for each route. Since the saved file is

    *** still on the screen all you have to do is change the Route Name*****

    *** from USA2 to the next Route name and .trk file name

    *** (USA2.TRK and USA2.OFF) and save.


    18. Once you have ON-OFF files for your routes done, go to where

    *** you have saved them. Create a new folder with your choice

    *** of name and place all the batch files in there.


    19. Individual routes can now be turned on or off using the appropriate

    *** batch file. When clicking on a batch file your screen will turn

    *** black for an instant. Not to worry, just the .bat doing its thing.


    METHOD 2


    20. Follow steps 1 through 13 above to create "ON" batch files for

    *** each route.


    21. Now to create a Master "OFF" batch file.

    *** Open WordPad or NotePad (XP).


    22. Type:* @ECHO OFF* <ENTER>


    23. Type:* CLS*** <ENTER>


    24. Type:* C:*** <ENTER>* See note in step 4


    25. Type:*


    ************ <ENTER>**********


    26. Type:* REN "USA2.TRK" "USA2.OFF"** <ENTER>



    27. Repeat steps 25 & 26 for each route before going to step 28.


    28. Type:* CLS* <ENTER>


    29. Follow steps 8 through 13 to save. In step 9 name this file:

    *** ALL-OFF.BAT


    30. You can now turn OFF all routes with one click and turn ON the

    *** route(s) you want.


    Cyndi Richards
    [email protected]



    Richard Shirey ([email protected]), inspired by this original how to, offers an alternative batch file with PIF to link to it from Windows. Richards notes that the program command line in the PIF properties will have to be modified to the location where the batch file is placed. Also, the question mark on the command line should be not deleted, as it signals Windows to prompt for command line options.

    Download Richard Shirey's version of the batch file.

  • Recent Forum Activity


    Various Screenshots with no particular theme... Part 2020

    Thread Starter: eolesen

    Everyone needs to follow the guidelines, starting with what's been in place for years and years : ...

    Last Post By: fchrist16 Today, 06:42 PM Go to last post

    Full Bucket Line as non-American route

    Thread Starter: Vazyuk

    Originally, Full Bucket Line is US-route, but some users imagine this route as Australian of South African for example. Also on the file libary of...

    Last Post By: Vazyuk Today, 03:21 AM Go to last post

    Derail Valley

    Thread Starter: NorthernWarrior

    Available now on Steam, best described as American (or European) Truck Simulator on rails, where you make money hauling cargo between various...

    Last Post By: haverfordwest Today, 06:52 PM Go to last post
    Strawberry Yogurt

    First Time Building a Model for MSTS/Open Rails

    Thread Starter: Strawberry Yogurt

    Hi guys, I've been gone for a few years, but just getting back into the hobby. I almost exclusively run passenger trains, mostly contemporary Amtrak....

    Last Post By: Strawberry Yogurt Today, 02:21 AM Go to last post

    NEC in progress

    Thread Starter: gusthegator

    I think it is about time we get a full NEC. Track from DC to Philly is flat, rest of the corridor will have more gradual inclines and declines....

    Last Post By: gusthegator Yesterday, 08:19 PM Go to last post

    Flock of Birds overhead

    Thread Starter: tie

    Has anyone built a set like this yet? Birds...any type. Ravens..crows...geese etc. I'm looking for some made already.

    Last Post By: lateagain Today, 05:58 PM Go to last post

    Microsoft Train Simulator v1.4 crashing on Startup (Windows 10, AMD Radeon RX 480)

    Thread Starter: 123mattyshoes

    Hello everyone. If this is a topic that has been posted before, I do apologize for bumping it. Recently, I wanted to get back into playing...

    Last Post By: 123mattyshoes Today, 11:31 AM Go to last post
    anderson martins

    wrecked models and locomotives

    Thread Starter: anderson martins

    Hello guys ! ! for having an outdated computer and also having no knowledge in publishers of creation, I launch a SUGGESTION here: The railway...

    Last Post By: bwbrgb Today, 06:20 PM Go to last post

    I can't find the rule list!

    Thread Starter: CWA13000

    I haven't set up a Session for a few months and now as I try to set one up in Trainz Railroad Simulator 2019, I can't find the page where one sets up...

    Last Post By: SurvivorSean Today, 01:43 PM Go to last post