Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there anyway to have preset data for user input in a batch file?

So basically I have a batch file that requires alot of user input. I was wondering if it was possible to have any filler data already present when the question is asked, and if the user needs to change something, they can go edit that data. For example

enter image description here And then the user enter their first and last name. enter image description here

But is it possible to start with a default name that the user can go back and edit if they need?

This probably isn't necessary, But this is the code I use for the user input.

Set /p "Author=Please enter your name: "

And I understand for the Author it wouldn't make much sense to have preset data, but there are other instances where it would be useful for me to do this. Is it possible?

like image 751
Jeremy Rowler Avatar asked May 08 '14 17:05

Jeremy Rowler


1 Answers

nearly impossible to edit a preset value with pure batch, but you can easily give a default value (works, because set /p is not touching the variable, if input is empty)

set "author=First Last"
set /p "author=Enter name or press [ENTER] for default [%author%]: "
echo %author%
like image 156
Stephan Avatar answered Sep 29 '22 01:09

Stephan