中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --

联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!

中国DOS联盟论坛
现在时间是 2026-06-13 20:42
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » bat 变量的应用.不是很懂,谁给解释一下
楼 主 bat 变量的应用.不是很懂,谁给解释一下 发表于 2008-03-09 23:47 ·  中国 河南 郑州 联通
初级用户
积分 21
发帖 7
注册 2007-08-08 16:22
UID 94842
性别 男
来自 河南
状态 离线
@echo off
echo a=b+c
:hom
set/p a="a="
set/p b="b="
set/p c="c="

if %a%==? set/p a="a="<nul &set/a ?=%b%+%c%
if %b%==? set/p b="b="<nul &set/a ?=%a%-%c%
if %c%==? set/p c="c="<nul &set/a ?=%a%-%b%

echo %?%
goto hom


一共就这么多,各位给看一下哈!!!!
2 发表于 2008-03-10 00:27 ·  中国 重庆 电信
版主
★★★★★
积分 9,023
发帖 5,017
注册 2007-05-31 19:39
UID 89899
性别 男
状态 离线
SET /A expression
SET /P variable=[promptString]

The /A switch specifies that the string to the right of the equal sign
is a numerical expression that is evaluated.

The /P switch allows you to set the value of a variable to a line of input
entered by the user. Displays the specified promptString before reading
the line of input. The promptString can be empty.
论坛跳转: