Variable is a named memory location that stores some
information.
How to define a
variable?
‘SET’ is a batch command used to define a variable.
Syntax
SET VARIABLE_NAME = VALUE
Example
SET firstName="Krishna"
SET age=29
How to print the
value of variable?
‘echo’ command is used to print the value of variable.
Syntax
echo %VARIABLE_NAME%
C:\>SET firstName="Krishna" C:\>SET age=29 C:\>echo %firstName% "Krishna" C:\>echo %age% 29
Points to note
a.
String are defined between double quotes
b.
Batch commands and variable names are case-insensitive.
C:\>echo %COUNTRY%
"India"
C:\>echo %country%
"India"
C:\>ECHO %country%
"India"
No comments:
Post a Comment