InputBox

Prompt for user input.

Syntax 
      InputBox(prompt[, title][, default]
         [, xpos][, ypos][, helpfile, context])

Key
   prompt   The dialogue box prompt text.
 
   title     Title bar text

   default   A default string to display 

   xpos      Distance from the left

   ypos      Distance from the top

   helpfile  A helpfile to link to the help button

   context   Helpfile context number

Input box returns a string containing the text entered

Examples

'Prompt for a message and then display it:

strMessage =Inputbox("Enter your message","Input Required")
WScript.Echo strMessage

:: Get user input from a CMD script and store in a variable:

@echo off
SETLOCAL

SET _prompt=%1

::Create the VBS script with an echo statement:
ECHO Wscript.Echo Inputbox("Enter %_prompt%","Input Required")>%TEMP%\~input.vbs

:s_GetInput
:: Run the vbScript and save the output
FOR /f "delims=/" %%G IN ('cscript //nologo %TEMP%\~input.vbs') DO set _string=%%G

:: Delete the VBS file
DEL %TEMP%\~input.vbs

:: Display the result
SET _string
ENDLOCAL & SET _input=%_string%

“Everyone has an invisible sign hanging from their neck saying, Make me feel important. Never forget this message when working with people” ~ Mary Kay Ash

Related:

MsgBox - Display a dialogue box message
Equivalent Powershell command: Read-Host


© Copyright SS64.com 1999-2014
Some rights reserved