开发者

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 wa开发者_运维知识库y 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


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜