Search code examples
batch-filedos

Interactive Batch File


How to proceed with an interactive batch file?

Eg.,

DO you want to continue? [y/n]

If 'y' Goto Label1

Else Goto Label2

Thanks


Solution

  • You can use the SET command. The following is the DOS command equivalent of the pseudo code you have above:

    set /p choice=Do you want to continue? [y/n]
    if '%choice%'=='Y' goto label1
    goto label2