109Views5Replies

Author Options:

How Can I Add Options To My Batch File? Answered

Picture of

How can I add options to my batch file?Like, for example, a box comes up with text, and has options such as abort\retry\cancel, or yes\no, etc. Please help!

5 Replies

user
orksecurityBest Answer (author)2010-08-17

The batch language has no provision for interaction. Generally what's done is to have it invoke a program which interacts with the user and leaves the answer in a testable place -- the program's return code, or creating/destroying a scratchfile which can be tested with "if exists".

Select as Best AnswerUndo Best Answer

user
Prof. Pickle (author)2012-08-09

You can't do anything like this using batch files (as far as I know) but I do know that you can do this with VBS.

Select as Best AnswerUndo Best Answer

user
orksecurity (author)2010-08-17

(I should say: You can, of course, read parameters from the rest of the command line. Or you can do a "press any key" using the pause keyword. But that's about it without helper programs. At least, unless Microsoft snuck another weirdity past us when I wasn't paying attention.)

Select as Best AnswerUndo Best Answer

user
Files (author)orksecurity2010-08-18

Hmm.. I think I'm going to try that. That sounds like it will work.

Select as Best AnswerUndo Best Answer

user
Files (author)2010-08-17

Okay, thank you.I could of sworn I've seen it before, but that might have been a VBS file..Thanks for the tip, I'll try something along those lines in due time.

Select as Best AnswerUndo Best Answer