in windows batch

Creating variables in Batch script We can create variables in batch script using below syntax.
 
SET <variable-name>=<value>

Here is an example where we have declared one variable name and it’s value is donald. Finally we have printed the value of name variable.
 
SET name=donald
echo %name%

Viewing all variables in Batch script

You can use “set” command to list all variables. Local and global scope of variables in Batch script Local scope variables are available in specific block. In below example – we have set one variable with name – “id” and assigned it a value as 12. If you try to print the value outside local scope, it will print nothing.
 
@echo off
SETLOCAL
    SET id=12
    echo id inside local scope %id%
ENDLOCAL

echo id outside local scope %id%

Complex problems, Simple Solutions