HOME
Stephen Knight
11/04/2009
09:17 PM
GUI Inputbox in batch file
Type:
VBScript, Batch/Command file
Category:
GUI, Input
Way of providing a GUI Input box in a batch script using one-line VBScript.
Code
@echo off
REM Input routine for batch using VBScript to provide input box
REM Stephen Knight, October 2009,
http://www.dragon-it.co.uk/
call :inputbox "Please enter something for me:" "Box Title"
echo You entered %Input%
exit /b
:InputBox
set input=
set heading=%~2
set message=%~1
echo wscript.echo inputbox(WScript.Arguments(0),WScript.Arguments(1)) >"%temp%\input.vbs"
for /f "tokens=* delims=" %%a in ('cscript //nologo "%temp%\input.vbs" "%message%" "%heading%"') do set input=%%a
exit /b
Explanation
Examples
Attachments