I am trying to execute a code in which a list of options are posted and when the corresponding number to the operation is pressed the command is executed and afterwards it asks again which command to perform. I have written the following code but it just runs all the commands automatically and stops automatically
@echo off
color B
echo Test File
echo Press any key to perform any of the following operations
echo 1) System Information
echo 2) Ping
SET var1="1"
SET var2="2"
if %var1%=="1" (
pause
systeminfo
)
if %var2%=="2" (
pause
ping www.google.com
)
Any help would be appreciated. Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire