'Clear Values On Bat Or Catch Null Value On If Statement

So I'm Trying To Wipe Variables After Use, Easiest Way I Found Was To Declare As It Follow's

:PING_IP
set IP=
set /p IP="Enter IP To Ping(0 Cancel): "


if %IP%==0 (
        cls
        goto IP_MENU
)   else    (
        ping %IP%
        pause
        cls
        goto IP_MENU
)

But In This Case Bat Will End, Cause There No Action To Capture The NULL Value Var If Not Use, Unsure How To Proceed



Solution 1:[1]

Just Found Out I Can Use "||" To Assign A Value If User Does Not Responds, Hopes This help Anyone

:PING_IP
set /p IP="Enter IP To Ping(0 Cancel): " || set "IP=0"


if %IP%==0 (
        cls
        goto IP_MENU
)   else    (
        ping %IP%
        pause
        cls
        goto IP_MENU
)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kevin Conce Cruz