China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-04 04:28
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Question] About variable localization! View 784 Replies 3
Original Poster Posted 2007-04-14 09:14 ·  中国 安徽 合肥 电信
初级用户
Credits 47
Posts 16
Joined 2007-04-02 09:47
19-year member
UID 83710
Gender Male
Status Offline
I’ve never really understood what variable localization is! Yet in some friends’ works I often see it appear. I also couldn’t find any materials about it on the forum, so I’d like to ask all the experts: what does variable localization mean, and what is it used for? Is it like the difference between local variables and global variables in high-level languages?

[ Last edited by myth126 on 2007-4-13 at 08:40 PM ]
Floor 2 Posted 2007-04-14 13:34 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline
It can be understood as a local variable. When the batch file finishes running, the variable is gone too, and the memory space allocated for it is also released; this is different from system variables (which can be understood as global variables).
Floor 3 Posted 2007-04-16 07:35 ·  中国 安徽 合肥 电信
初级用户
Credits 47
Posts 16
Joined 2007-04-02 09:47
19-year member
UID 83710
Gender Male
Status Offline
Thanks for your reply! It’s still not very clear! ^_^ Then are variables that aren’t localized just system variables? Feels a bit confusing! ^_^
Floor 4 Posted 2007-04-16 11:34 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline
Variables set in a batch script are generally local, while system variables can be used directly without needing to be set.
Forum Jump: