Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ::VBSINPUT.CMD was written by Fawers
- ::==================================
- ::Syntax:
- ::vbsinput varName [text] [windowTitle] [defaultInput]
- :: --varName Variable name
- :: --text Brief description or question
- :: --windowTitle Window Title
- :: --defaultInput Default option
- ::Parameters in [brackets] are optional.
- ::
- ::Inspired by Rob van der Woude's code to capture VBScript output on DOS
- ::http://www.robvanderwoude.com/usermessages.php
- @echo off
- if "%~1" == "" (
- setlocal enableDelayedExpansion
- echo,
- for /f "skip=2 delims=" %%t in ('type "%~f0"^|find "::"^|find /v "for /f"'
- ) do (set line=%%t
- echo,!line:~2!
- )
- endlocal
- exit /b 1
- )
- pushd %temp%
- set vbs="%~n0.vbs"
- for /f "tokens=2 delims=:" %%c in ('chcp') do set /a "code=%%c"
- if not [%code%] == [1252] chcp 1252 >nul 2>&1
- >%vbs% echo wscript.echo inputbox("%~2", "%~3", "%~4"^)
- chcp %code% >nul 2>&1
- set code=
- for /f "delims=" %%v in ('cscript //nologo %vbs%') do ^
- if not "%%~v" == "" set "%~1=%%v"
- del %vbs%
- set vbs=
- popd
- exit /b
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement