VB input to batch programs

Hewlett-packard / Sd2100
May 5, 2009 at 06:16:06
Specs: Windows XP, 1024
how does this work with a menu in a batch file?
would someone write me an example for it because i cant seem to get it to work.

thanks Brock

code is below


using the
'call' command to call for the vbscript file which should be in the same folder as the .bat file.

in the batch file pretty much anywhere you can start the vbscript, and call another
.bat file- using @ to of course not echo the line of code -
CODE
@ start /w wscript.exe userin.vbs
@ call ~anyname.bat
@ del ~anyname.bat


now for the .vbs file : create userin.vbs using a text editor such as notepad -
CODE
strUserIn = InputBox("This is the the input box will say")
Set fs = CreateObject("Scripting.FileSystemObject")
strFileName = fs.BuildPath(Wscript.ScriptFullName & "\..", "~anyname.bat")
strFileName = fs.GetAbsolutePathName(strFileName)
Set ts = fs.OpenTextFile(strFileName, 2, True)
ts.WriteLine "set userin=" & strUserIn
ts.Close[code]

Now we use what ever was typed in to execute a command.
So any dos/batch command that makes sense will fit there

[code]@ Batch/doscommand -A %USERIN%


See More: VB input to batch programs

Report •


#1
May 6, 2009 at 06:59:56
any ideas guys? i found that code online but not sure how to sure it in a batch menu for input

thanks


Report •

#2
May 8, 2009 at 19:42:11
i need help to figure this out this code


strUserIn = InputBox("This is the the input box will say")
Set fs = CreateObject("Scripting.FileSystemObject")
strFileName = fs.BuildPath(Wscript.ScriptFullName & "\..", "~anyname.bat")
strFileName = fs.GetAbsolutePathName(strFileName)
Set ts = fs.OpenTextFile(strFileName, 2, True)
ts.WriteLine "set userin=" & strUserIn
ts.Close[code]

let me have user input for a VBS but when i call it in a menu it will only just move down to the nexted line.

if i have a menu and i call that vbs for input will only GOTO the first option and if i select a different option it always goes to the first option.

but SET /p works in batch i just want to use the VBS input box. if any one can help that be great .


Report •

#3
May 9, 2009 at 03:15:50
@echo off & setlocal

>$$$.vbs echo wsh.echo inputbox("enter something")

for /f "tokens=*" %%a in ('cscript//nologo $$$.vbs') do set var=%%a
echo.%var%


Report •

Related Solutions

#4
May 12, 2009 at 14:38:39
Thanks Reno that work GREAT, now thats a good code for any whot want a VBS input box in batch.

Report •

#5
May 14, 2009 at 20:23:27
Removed Post

Report •

#6
May 14, 2009 at 23:28:44
Kinda off topic but do you know how to use a VBS yes no and have it work with goto commands in batch?


Report •


Ask Question