James-Jesse Drinkard
James-Jesse Drinkard

Reputation: 15713

prompt in window for vbscript

I have a vbscript that runs on the command line in xp. It accepts one argument for the path to a directory. Is there a simple way to prompt the user in the command line box for this?

If not, I can just echo what was passed in to show the user what they actually typed in case of typos.

Thanks, James

Aftermath:

Here is the code I ended up with:
On Error Resume Next strDirectory = InputBox(Message, Title, "For example - P:\Windows\")

If strDirectory = "" Then
    'Wscript.Echo cancelledText
Else
    'Wscript.Echo enteredText & strDirectory
etc...                                                                

I found some snippets and it turned out to be really simple to work with the inputBox.

HTH.
James

Upvotes: 0

Views: 318

Answers (2)

user69820
user69820

Reputation:

You can use the WScript.StdIn property to read from the the standard input. If you want to supply the path when invoking the script, you can pass the path as a parameter. You'll find it in the WScript.Arguments property.

Upvotes: 1

Rodolfo
Rodolfo

Reputation: 4183

you can use the choice command, choice it sets errorlevel to the value selected. I think it comes with DOS, Windows 95,98, then MS dropped it and then came back again in Windows 7 and probably Vista

P.D. oh never mind, I read again and you're in XP. There are other options, like set /p name= What is your name? would create a variable %name% you can use

Upvotes: 0

Related Questions