I have a program I want to execute with a line like this:
gams.exe program.gms user-defined-variable1 user-defined-variable2 ..........
Currently I use a batch file which prompts the user for input strings which are the user-defined variables, for example:
code:
set /P scen_num="(What scenario number would you like to simulate?) "
output:
(What scenario number would you like to simulate?)
- the user types:
1
I use this batch file very often and there are multiple parameters. I would like to write the most-recent parameters to a text file, so that the next time I run the batch (or Powershell) file, the previously-used setting will be there on the prompt:
(What scenario number would you like to simulate?) 1
So I can spam ENTER if I want to execute exactly the same thing as the previous time.
Ideally I want to be able to do this in batch, though Powershell is acceptable if batch cannot do this.
- How do I output to / read from a text file?
- How do I make the prompt already contain a specified value before I type anything?