Jump to content
Sign in to follow this  
SKEWR

Creating a Batch File for Win10

Recommended Posts

Hello all,

I'm trying to get a batch file that will open my most used addons with one click. I read up on batch files and I'm trying make it work. After some research, I created the following:

@echo off

cd "F:\Program Files (x86)\HiFi\AS_P3Dv4\AS_P3Dv4"
start "AS_P3Dv4.exe"

cd "G:\Prepar3D v4\Modules"
start "LINDA.exe"

pause

 

This above does not work at all. Can someone please tell me what I'm doing wrong?

 

Thanks in advance!


"I am the Master of the Fist!" -Akuma
 

Share this post


Link to post

I think you need   exit   at the end.

Edited by Psybear

Clayton Scott

Win10 Pro x64v2004 -256GB M.2 600p | Prepar3D v5.0 hf2 -512GB M.2 960Pro | Storage -1TB 850 Pro
Z270 XPower Titanium / i7-7700K @4.7GHz-H115i / 32GB Trident Z @3200MHz 14-14-14-34
GTX1070 Quicksilver (451.48) | 34W 2560x1080 | Crystal 460X-AX860i

 
 

Share this post


Link to post

May I make an unsolicited suggestion? For a couple of years I used a batch file to do exactly what you are trying (and more, swapping out fsx.cfg files, for example). 

Buy SimStarterNG. 

The fact that you are trying a batch file demonstrates your expertise and vision. SimStarterNG can do this and much more to customize your sim startup environment.

Best of luck with your travels.

 

 

  • Upvote 2

Share this post


Link to post

The cd command will not switch between drives without the /d option:

cd/d "F:\Program Files (x86)\HiFi\AS_P3Dv4\AS_P3Dv4" 

or alternatively, change drives with a separate discrete command

F:
cd "\Program Files (x86)\HiFi\AS_P3Dv4\AS_P3Dv4" 

The pause command will leave the command window open while the sim runs.  I'd leave out the pause command.

If you want to see the output of the commands, particularly errors, stream the output to a file when you run it, e.g. mybat >out.txt

and then look through out.txt to review the console output.

 

A better option might be to run Linda at P3D startup using the run= command in the FSUIPC.ini file.

Regards

 

  • Like 1
  • Upvote 1

Bob Scott | President and CEO, AVSIM Inc
ATP Gulfstream II-III-IV-V

System: i9-10900K @ 5.2GHz on custom water loop, ASUS Maximus XII Hero, 32GB GSkill 3600MHz CAS15, EVGA RTX3090 XC3 Ultra
Samsung 55" JS8500 4K TV@30Hz,
3x NVME 2x SATA Samsung SSD, EVGA 1KW PSU, 1.2Gbps internet
SoundBlaster XFi Titanium, TOSLINK to Yamaha RX-V467 HT Rcvr, Polk/Klipsch 6" bookshelf spkrs, Polk 12" subwoofer, 12.9" iPad Pro
PFC yoke/throttle quad/pedals with custom Hall sensors, Coolermaster HAF932 case, Stream Deck XL button box

Share this post


Link to post
1 hour ago, Henry Street said:

Buy SimStarterNG. 

+1, superb application. Can’t imagine simming without it now.


Best regards

Rupert

Share this post


Link to post

Hi,

the "start" command doesn't exist in native DOS. It is unnecessary, every line of the batch file expects an executable or a native DOS command.

"test.bat":

Quote

@echo off
F:
cd "F:\Program Files (x86)\HiFi\AS_P3Dv4\AS_P3Dv4"
"F:\Program Files (x86)\HiFi\AS_P3Dv4\AS_P3Dv4\AS_P3Dv4.exe"
G:
cd "G:\Prepar3D v4\Modules"
"G:\Prepar3D v4\Modules\LINDA.exe"

pause

You may not even have to change the directory first, but that depends on what the exe expects.

Other methods:

  • With P3D V3 and V4 you can add executables to an addon package and start them when the sim starts

The XML would be here: "C:\Users\...\Documents\Prepar3D v4 Add-ons\MyAutoStart\add-on.xml" and look like this:
 

Quote

<?xml version="1.0" encoding="UTF-8"?>
<SimBase.Document Type="AddOnXml" version="4,0" id="add-on">
<AddOn.Name>MyAutostart</AddOn.Name>
<AddOn.Description>Addons to start with the sim</AddOn.Description>
<AddOn.Component>
<Category>EXE</Category>
<Path>F:\Program Files (x86)\HiFi\AS_P3Dv4\AS_P3Dv4\AS_P3Dv4.exe</Path>
</AddOn.Component>

<AddOn.Component>
<Category>EXE</Category>
<Path>G:\Prepar3D v4\Modules\LINDA.exe</Path>
</AddOn.Component>
</SimBase.Document>

or

  • You can add those exes to one of the exe.xml files
  • Use some other startup tool like FSUIPC or SimStarter

Best regards

Edited by Lorby_SI
  • Upvote 2

LORBY-SI

Share this post


Link to post

Thank you all for the help!

I'll do some research on SimStarter. Quick question about the app: Does it stay in memory or does it terminate after it starts the various exe?

 

@w6kd @Lorby_SI

Thank you very much for the help. I'll be working my way through both options. Much appreciated!


"I am the Master of the Fist!" -Akuma
 

Share this post


Link to post

If you're interested, here's my batch file in Windows 7. You can try to see if it works in Win 10:

@echo off
start "Active Sky P3Dv4" "E:\HiFi\AS_P3Dv4\AS_P3Dv4.exe"
CHOICE /N /C YN /T 13 /D Y >NUL
start "FFTF Dynamic" "E:\FSPS LTD\FFTF Dynamic P3Dv4\FFTF Dynamic P3Dv4.exe"
CHOICE /N /C YN /T 5 /D Y >NUL
start "Enviro ATC Chat" "F:\Enviro!\Enviro!.exe"
CHOICE /N /C YN /T 1 /D Y >NUL
start "Prepar3D v4" "E:\Lockheed Martin\Prepar3D v4\Prepar3D.exe"


It adds a pause of 13 seconds after starting ASP4, 5 secs after starting FFTF Dynamic and 1 sec.before starting P3Dv4.3.

Cheers, Ed

 


Cheers, Ed

MSFS Steam - Win10 Home x64 // Rig: Corsair Graphite 760T Full Tower - ASUS MBoard Maximus XII Hero Z490 - CPU Intel i9-10900K - 64GB RAM - MSI RTX2080 Super 8GB - [1xNVMe M.2 1TB + 1xNVMe M.2 2TB (Samsung)] + [1xSSD 1TB + 1xSSD 2TB (Crucial)] + [1xSSD 1TB (Samsung)] + 1 HDD Seagate 2TB + 1 HDD Seagate External 4TB - Monitor LG 29UC97C UWHD Curved - PSU Corsair RM1000x - VR Oculus Rift // MSFS Steam - Win 10 Home x64 - Gaming Laptop CUK ASUS Strix - CPU Intel i7-8750H - 32GB RAM - RTX2070 8GB - SSD 2TB + HDD 2TB // Thrustmaster FCS & MS XBOX Controllers

Share this post


Link to post

windows 10 / Server 2012R2 adds into the mix "powershell." You could also write an auto-start method in this. We used it a lot where I work for various things.

 

 


John Binner, MCDST
U.S. Dept Of Veteran Affairs Information Technology Analyst

Region 4 Business Critical Systems

new 2020 Build: Thermaltake Core X71 Full tower case, ASUS Prime X570-P Motherboard, AMD Ryzen 7 3700X CPU, ASUS TUF Gaming X3 Radeon RX5600 XT GPU, G.SKILL Ripjaws 32GB DDR 3600 RAM, Thermaltake Toughpower GF1 850W 80+ Gold PSU, Cooler Master MasterLiquid ML240L Water Cooler

 

Share this post


Link to post

Could somebody give an example of  a batch file, that starts some service apps first then launches the main program, then waits for the main exe to terminate and finally closes the service apps one by one? 

Thanks.

Edited by Dirk98

Share this post


Link to post

Hello,

this one starts Rex Environment Force, then Active Sky and finally P3D v4.

You would need to edit the P3D path (in red) to match your installation

Quote

 

@echo
cls
rem Rex Environment Force
cd /D G:\P3D v4\REXModules\
start rexenvforce.exe
timeout /t 6
rem AS_P3Dv4
cd /D C:\Program Files (x86)\HiFi\AS_P3Dv4\
start AS_P3Dv4.exe
timeout /t 4
rem P3D v4
cd /D G:\P3D v4
start Prepar3D.exe
timeout /t 4

exit

 

This one closes P3D v4, then Rex Environment Force and then Active Sky.

Quote

@echo
cls
taskkill /F /im Prepar3D.exe
timeout /t 6
taskkill /F /im rexenvforce.exe
timeout /t 4
taskkill /F /im AS_P3Dv4.exe
timeout /t 4
exit

 

Edited by Reader

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...