Page 1 of 1
Window from Batch? [SOLVED]
Posted: 01 Aug 2023 06:36
by MikeInThe901
I can use the code below in a batch file to get keyboard input from a command prompt. Is it possible to do the same thing but get the input from a Window instead of a prompt?
set /p Var=What is your name:
Thanks!
Re: Window from Batch?
Posted: 01 Aug 2023 08:27
by Batcher
test-1.bat
Code: Select all
@echo off
for /f "delims=" %%i in ('powershell "Add-Type -AssemblyName Microsoft.VisualBasic; [Microsoft.VisualBasic.Interaction]::InputBox('What is your name:')"') do (
set "Var=%%i"
)
echo,%Var%
pause
Re: Window from Batch?
Posted: 01 Aug 2023 08:46
by Batcher
test-2.bat
Code: Select all
@echo off
>"%temp%\GetInput.vbs" echo WSH.Echo InputBox("What is your name:")
for /f "delims=" %%i in ('cscript "%temp%\GetInput.vbs" //nologo //e:vbscript') do (
set "Var=%%i"
)
echo,%Var%
pause
Re: Window from Batch?
Posted: 01 Aug 2023 10:00
by MikeInThe901
Thank you again Batcher! I appreciate your help.