Sign in with
Sign up | Sign in
Your question
Solved

How can I make a batch file that has different launch options?

Tags:
  • Programming
  • Battlefield
  • Steam
  • Apps
Last response: in Apps General Discussion
Share
January 4, 2013 6:40:50 AM

I bought battlefield 2 off steam, and I want to have 3 or 4 installations; 1 untouched and the rest with different mods.

I want to make a batch file that has something along the lines of "Press 1 for...., 2 for.. etc"

If I do this, then I can convert the batch to an exe, rename it to BF2.exe and replace the original, therefore letting me launch different installations of BF2 while still counting them towards my play time (Rather than adding non steam shortcuts)


What commands would I need? Thanks!

More about : make batch file launch options

Best solution

a b L Programming
January 4, 2013 6:55:29 AM

Well for starters what you are trying to do won't work. You can't rename a batch script to a .exe and expect it to work. Windows expects that anything with a .exe extension will be a binary executable, but yours is just a text file.
Share
January 4, 2013 6:59:25 AM

I have a program that converts batches to EXEs, and it works fine. And also I think I found the code I was looking for

EDIT: Disregard this thread, I found the commands I needed and was able to edit them accordingly :D 

------------------------------------------------------------------------------------------------

ECHO OFF
CLS
:MENU
ECHO.
ECHO --------------------------------------------------
ECHO Battlefield 2 Mod Launcher
ECHO --------------------------------------------------
ECHO.
ECHO 1 - Battlefield 2 (No Mods)
ECHO 2 - Battlefield 2 (Project Reality)
ECHO 3 - Battlefield 2 (Mod 3)
ECHO 4 - Battlefield 2 (Mod 4)
ECHO.
SET /P M=Type 1, 2, 3, or 4 then press ENTER:
IF %M%==1 GOTO NOMODS
IF %M%==2 GOTO PROJECTREALITY
IF %M%==3 GOTO 3
IF %M%==4 GOTO 4
:NOMODS
cd C:\Program Files (x86)\Steam\steamapps\common\Battlefield 2\1\
start BF2.exe
GOTO MENU
:p ROJECTREALITY
cd C:\Program Files (x86)\Steam\steamapps\common\Battlefield 2\2\
start BF2.exe
GOTO MENU
:3
cd C:\Program Files (x86)\Steam\steamapps\common\Battlefield 2\3\
start BF2.exe
GOTO MENU
:4
cd C:\Program Files (x86)\Steam\steamapps\common\Battlefield 2\4\
start BF2.exe
GOTO MENU
m
0
l
Related resources
January 4, 2013 7:08:30 AM

Best answer selected by Bl00dyMurd3r.
m
0
l
January 19, 2013 1:32:36 PM

If you put an @ in front of ECHO OFF, it disables ECHO for that line.
- This is why so many batch files start with @ECHO OFF, instead of ECHO OFF followed by CLS.
- For batch files under 8 lines put @ in front of every line
- In yours it means you won't have to call CLS (Clear Screen) immediately afterwards to 'hide' the output.
- You've also left out quotes in the directory names (they have a space in them), which for CHDIR (CD) isn't a major issue as the Windows Command Prompt somewhat auto-corrects, it's still a potential cause of problems down the track.

If you make a keyboard input error it might fall through to your :NOMODS label too.
That and there's no way (within the batch file anyway) to exit it cleanly.

Batch files are freaking awesome, I used to love writing them!

The only issue with your idea that I can immediately think of is that if you verify the steam cache it might look at the 4 folders, your 'different' BF2.EXE and freak out a little.
m
0
l
!