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!
Window from Batch? [SOLVED]
Moderator: DosItHelp
-
- Posts: 6
- Joined: 24 Apr 2023 11:13
Window from Batch? [SOLVED]
Last edited by MikeInThe901 on 01 Aug 2023 10:00, edited 1 time in total.
Re: Window from Batch?
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?
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
-
- Posts: 6
- Joined: 24 Apr 2023 11:13
Re: Window from Batch?
Thank you again Batcher! I appreciate your help.