Computing.Net > Forums > Programming > VB input to batch programs

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

VB input to batch programs

Reply to Message Icon

Name: brockey01
Date: May 5, 2009 at 06:16:06 Pacific
OS: Windows XP
CPU/Ram: 1024
Product: Hewlett-packard / Sd2100
Subcategory: Batch
Comment:

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%



Sponsored Link
Ads by Google

Response Number 1
Name: brockey01
Date: May 6, 2009 at 06:59:56 Pacific
Reply:

any ideas guys? i found that code online but not sure how to sure it in a batch menu for input

thanks


0

Response Number 2
Name: brockey01
Date: May 8, 2009 at 19:42:11 Pacific
Reply:

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 .


0

Response Number 3
Name: reno
Date: May 9, 2009 at 03:15:50 Pacific
Reply:

@echo off & setlocal

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

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


0

Response Number 4
Name: brockey01
Date: May 12, 2009 at 14:38:39 Pacific
Reply:

Thanks Reno that work GREAT, now thats a good code for any whot want a VBS input box in batch.


0

Response Number 5
Name: brockey01
Date: May 14, 2009 at 20:23:27 Pacific
Reply:

Removed Post


0

Related Posts

See More



Response Number 6
Name: brockey01
Date: May 14, 2009 at 23:28:44 Pacific
Reply:

Kinda off topic but do you know how to use a VBS yes no and have it work with goto commands in batch?


0

Sponsored Link
Ads by Google
Reply to Message Icon

convert yyyy/d/m to yyyy/... c programing



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: VB input to batch programs

Vbs talking to batch www.computing.net/answers/programming/vbs-talking-to-batch/20327.html

batch programming help reqd www.computing.net/answers/programming/batch-programming-help-reqd/15695.html

Assign file contents to batch var! www.computing.net/answers/programming/assign-file-contents-to-batch-var/15181.html