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

bl00dyMurd3r

Honorable
Nov 30, 2012
4
0
10,510
0
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!

 

randomizer

Distinguished
Moderator
Jul 24, 2006
880
0
19,260
62
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.
 

randomizer

Distinguished
Moderator
Jul 24, 2006
880
0
19,260
62
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.
 

bl00dyMurd3r

Honorable
Nov 30, 2012
4
0
10,510
0
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
:pROJECTREALITY
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
 

Scott_D_Bowen

Honorable
Nov 28, 2012
50
0
10,590
1
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.
 
Thread starter Similar threads Forum Replies Date
David___Only Apps General Discussion 0
S Apps General Discussion 4
M Apps General Discussion 3
D Apps General Discussion 2
N Apps General Discussion 1
NoctisLionward Apps General Discussion 2
malavena Apps General Discussion 3
Tom Waller Apps General Discussion 2
P Apps General Discussion 1
S Apps General Discussion 4
A Apps General Discussion 13
Z Apps General Discussion 1
P Apps General Discussion 7
G Apps General Discussion 0
T Apps General Discussion 5
SHADOWSTRIKE1 Apps General Discussion 3
S Apps General Discussion 3
R Apps General Discussion 3
P Apps General Discussion 2
M Apps General Discussion 3

ASK THE COMMUNITY