Windows 10

How To Clear A Variable In A Batch File

In this tutorial, we are going to see how to clear a variable in a batch file. The batch file contains a series of DOS (Disk Operating System) instructions. It allows triggering the execution of commands found in this file.
 

How To Clear A Variable In A Batch File

The following example clear the variable “var” using set command:

@echo off

set "var=Hello"

echo %var%

set "var="   REM Clear the variable

echo %var%

Output:

Hello
ECHO is off.

 

Leave a Reply

Your email address will not be published. Required fields are marked *