2

I apologize if this is a) in the wrong section or b) a stupid question, but I've had little-to-no experience writing BAT files. I'm trying to make a simple startup script for a game (specifically TF2). The way it runs is it takes a bunch of parameters in the startup, but the one I care about it the map. I want it to start with "What map do you want?", then wait for an input, then simply put that input in place of where a map would go in the startup. I haven't been able to find this simple answer online so far, so here I am. Here's the current script.

tf2\srcds.exe -console -game tf +sv_pure 1 +map MAP_HERE +maxplayers 24

How should I go about writing something like this?

famousgarkin
  • 13,687
  • 5
  • 58
  • 74
Chris
  • 33
  • 7
  • 1
    The answer you seek lies here: http://stackoverflow.com/questions/1223721/in-windows-cmd-how-do-i-prompt-for-user-input-and-use-the-result-in-another-com – Vilx- Apr 26 '15 at 16:18

1 Answers1

1

Using SET:

SET /P map=What map do you want?
tf2\srcds.exe -console -game tf +sv_pure 1 +map %map% +maxplayers 24

SET /P variable=[promptString]

The /P switch allows you to set the value of a variable to a line of input entered by the user. Displays the specified promptString before reading the line of input. The promptString can be empty.

See cmd> set /? for more on SET.

famousgarkin
  • 13,687
  • 5
  • 58
  • 74