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

And then the user enter their first and last name.

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?

The method below have the inconvenience that the screen must be cleared before the user enter the data, but I am working trying to solve this point:

EDIT: I fixed the detail of the first version

@if (@CodeSection == @Batch) @then

@echo off
rem Enter the prefill value
CScript //nologo //E:JScript "%~F0" "First Last"
rem Read the variable
echo -----------------------------------------------------------
set /P "Author=Please enter your name: "
echo Author=%Author%
goto :EOF



For further details, see this post.

Is there anyway to have preset data for user input in a batch file , How to use the TYPE CON command to receive user input Data Input Routine! shows a way to use a graphical box to ask for user input in Windows 95 tip # 0323: How can I get a batch file to prompt me for parameters? shows a way to get a Return username and password, delimited by a semicolon (default) or tab� Where Path to your sandboxes folder: is part of a set /p command in a script waiting for an input; and C:\Whatever\Path\Sandboxes has been typed-in by the script as a pre-offered path. From here the user can either hit ENTER, if satisfied with offered path or edit it: C:\Whatever\OtherPath\Sandcastles

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%

Batch files - Ask For User Input, Presently, I only know how to launch the prompts in the specific folders. Get user input from an NT batch file. the following blog posts before you continue reasons I can't guarantee that the window will close before exposing that data ( arrow This is the default structure of the bash prompt on many Linux systems and is� In this tutorial I will be showing you how make a batch file that request user input. There are many thing you will be able to do with this such as creating a batch file that requires a user name

You can set the var first and then prompt the user only if it's not defined like so:

set Author=First Last
if not defined Author set /p "Author=Please enter your name: "

You can also do this backwards where you can define a value if the user didn't define it, like so:

set /p "Author=Please enter your name: "
if not defined Author set Author=First Last

Batch File Prompt For Input Yes No, We know how to query the register, now we need to create the batch file which all those field of IP address, Subnet mask, Default gateway and DNS servers respectively. execution", though a batch file may not process a batch of multiple data. txt file Mar 08, 2009 � A batch file can take any number of input arguments . Simple user input in batch files. I was recently playing around with batch scripts (*.bat files) - but what I wanted to do with the script snowballed and I found I needed more functionality, the main one being to be able to execute commands based on user input. Below is an example of the code I used to do this.

Another possibility is to use the editv32.exe or edit64.exe program (, which makes this very simple:

set NAME=Gill Bates
editv32 -p "Enter your name: " NAME

editv32.exe/editv64.exe are unrestricted copyrighted freeware.

Batch file on error goto, #!/bin/bash exit 1 The SimplePayrollJob batch job involves reading input data for payroll These set the default variables for the system and programs. Does this mean this user doesnt have the rights to excute a batch file? how did this user� In this video we take a look at the set command, and user input when creating batch files. Subscribe or follow us on twitter: @wearecODeAclysm https://twitte

Another alternative is ReadLine.exe:

@echo off
set NAME=First Last
for /f "delims=" %%n in ('ReadLine -p "Enter name: " -- %NAME%') do set NAME=%%n
echo You entered: %NAME%

You can get it from Source code is included.

Batch file exit, BAT file, you will have to run it or the associated command prompt window May 12, 2009 � How to set Consolas as the default font in Command Prompt Window ? It's used as an input file for the command-line interpreter CMD to run a set of batch file, the %choice% variable is assigned when the user enters data and� I need to know how to get and save user input in a simple batch file. I want the batch file to save the input to a text file on a computer (even if it isn't mine) and then have it sent to my email. Anyone got any idea's. Note: I am only a Junior but I have been working with batch files for about three years and I am learning to program in Java.

Batch cmd colors, My question is, how can I make the batch file automatically enter the password, Example: 'Password','myPassword123' This is just the default way for If user input is the password (%password%) then goto CORRECT. exe Start You can export the form data to a Tab-separated text file, Microsoft Excel File or FDF File. (y/n)" set INPUT=%ERRORLEVEL% if %INPUT% EQU 1 goto yes if %INPUT% EQU 2 goto no :yes shutdown /s :no pause For the if command, you have the C++ syntax for equals. In batch, you use EQU for equals, NEQ for not equal, LSS for less than, LEQ for less than of equal to, GTR for greater than, and GEQ for greater than or equal to.

Input password in batch file, Batch Script - Variables - There are two types of variables in batch files. One is for parameters which can be passed when the batch file is called and the other of how this would look in the command prompt when the batch file is executed. local scoped variables have a defined boundary in which they can be accessed. Stack Exchange network consists of 177 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Batch Script - Variables, Batch file scripts are not case-sensitive, although strings and data are. The file is controlled by a list of commands separated into lines which are run like normal� Batch files are extremely "weakly typed" (to use the understatement of the millennium): everything is a string, and a string can be everything, command as well as data, or even both, and there is no way to distinguish between the two. This makes batch code insertion more than a potential threat.

  • @JeremyRowler: I fixed the detail of the first version. See the edit in my answer...
  • Just a note that I don't recommend the SendKeys method in a production environment because you can't guarantee which foreground window has focus. There may be some cases where this does not behave as expected.
  • @Aacini, found a similar question today and apparently this type of code has problems with special characters.…
  • Nice solution, however can it be placed in the middle of a batch file containing other code? I'm having a hard time adapting it. Is it possible? Thanks
  • @Rakha: Yes. You may place any Batch code you want between @echo off and goto :EOF lines, just preserve the rest of lines...
  • This is perfect! Exactly what I needed!