dimanche 8 septembre 2019

How can I use goto function in bat file?

I am writing bat file having if statement goto command not working in first statement

:purge_operation

set /p ABC_DEF=Are you want to Purge ABC or DEF Data ? (ABC/DEF):

:start if %ABC_DEF%==ABC goto ABC if %ABC_DEF%==DEF goto DEF :end

:ABC echo purge ABC data !

:DEF echo purge DEF data !

pause >nul

output:------------

Actual Result---------

Are you sure you want to Purge DATA ? (Y/N):Y Are you want to Purge ABC or DEF Data ? (ABC/DEF):ABC purge ABC data ! purge DEF data !

Expected Results---- Are you sure you want to Purge DATA ? (Y/N):Y Are you want to Purge ABC or DEF Data ? (ABC/DEF):ABC purge ABC data !

Aucun commentaire:

Enregistrer un commentaire