Prompt for user input.

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

   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


'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

SET _prompt=%1

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

:: 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 VBScript commands

MsgBox - Display a dialogue box message.
Equivalent PowerShell cmdlet: Read-Host

Copyright © 1999-2023
Some rights reserved