|Purpose:||Pops up a dialog box to get an input string from the user and save it in an environment variable|
|Format:||QUERYBOX [/CUE="text" /D /E /Ln /P /POS=top,left /Tn] ["title"] prompt %%varname|
|title||Text for the title bar of the dialog box.|
|prompt||Text that will appear inside the dialog box.|
|varname||Variable name where the input will be saved.|
|/CUE||Cue text to display in the input box|
QUERYBOX displays a dialog box with a prompt, an optional title, and a string input field. Then it waits for your entry, and places any characters you type into an environment variable. QUERYBOX is normally used in batch files and aliases to get text input.
QUERYBOX is similar to INPUT, except it appears as a popup dialog box. If you prefer to work within the command line window, see the INKEY and INPUT commands.
The /CUE option displays the cue text in light gray in the input box (it disappears as soon as you enter a character).
Standard command line editing keys may be used to edit the input string as it is entered. All characters entered up to, but not including, the carriage return are stored in the variable.
If you press Ctrl-C or Ctrl-Break while QUERYBOX is waiting for input, execution of an alias will be terminated, and execution of a batch file will be suspended while you are asked whether to cancel the batch job. A batch file can handle Ctrl-C and Ctrl-Break itself with ON BREAK.
QUERYBOX returns a value of zero in the internal variable %_? after a successful operation, and a non-zero value otherwise (a timeout returns 20, a cancel returns 2). Be sure to save the return value in another variable or test it immediately; because the value of %_? changes with every internal command.
To prompt for a string and store it in the variable NAME:
querybox "File Name" Enter a name: %%name
|/E||Allows you to edit an existing value. If there is no existing value for varname, QUERYBOX allows you to enter a new value.|
|/POS||Sets the dialog position. (If you don't specify a position, QUERYBOX will center the dialog in the TCC window.|