|
|
Get User Input From Vbscript For Batch Files - Get user input from vbscript | ||
Discussion by netc0n with 4 Replies.
Last Update: November 4, 2011, 5:29 am | |||
Hello, I didn't see a tutorial on this subject so i'll go ahead and do it.
Long ago I used batch file programming a quite a bit. I used vbscript files
to get user input for the batch files. So here is a simple example of 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 -
@ call ~anyname.bat
@ del ~anyname.bat
now for the .vbs file : create userin.vbs using a text editor such as notepad -
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%
And that is the basic idea of using vbs for batch files.
Long ago I used batch file programming a quite a bit. I used vbscript files
to get user input for the batch files. So here is a simple example of 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%
And that is the basic idea of using vbs for batch files.
Wed Feb 8, 2006 Reply New Discussion
question
Get User Input From Vbscript For Batch Files
I search for a thing like this.
I would like to open in a VBS file a custom Windows dialog box to find for a file in my computer (the custom dialog in File -> Open) and pass the path of the file to a BATCH file.
Is it possible ?
-reply by cgialloporpora
Get User Input From Vbscript For Batch Files
I search for a thing like this.
I would like to open in a VBS file a custom Windows dialog box to find for a file in my computer (the custom dialog in File -> Open) and pass the path of the file to a BATCH file.
Is it possible ?
-reply by cgialloporpora
Thu Mar 20, 2008 Reply New Discussion
how to transfer data from one folder to another automaticali using vbscript batch file
Get User Input From Vbscript For Batch Files
How to transfer data from one folder to another automaticali using vbscript batch file
-question by shrikant
Get User Input From Vbscript For Batch Files
How to transfer data from one folder to another automaticali using vbscript batch file
-question by shrikant
Sun Jul 13, 2008 Reply New Discussion
ASP Classic validation of user inputGet User Input From Vbscript For Batch FilesI have made a registration form that take the user input I need code to validate it at server side I need urgent help.-question by suman
Wed Dec 3, 2008 Reply New Discussion
Search File Get User Input From Vbscript For Batch Files
Replying to FeedBacker I want to search file from my computer and should display the path into the text file.
-reply by Reyaj
Fri Nov 4, 2011 Reply New Discussion
Ruby On Rails Is ruby on rails a good language? (0)
|
(3) The Fat File System - Part 1
|
Index




