中国DOS联盟论坛

中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --
联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
游客 | 登录 | 注册 | 会员 | 搜索 | 中国DOS联盟
中国DOS联盟论坛
现在时间是 2026-08-07 17:25
48,041 主题排行 / 350,128 发帖 / 今日 3 篇 / 48,252 会员排行
DOS批处理 & 脚本技术(批处理室) » bat 变量的应用.不是很懂,谁给解释一下
可打印版本  747 / 1
第1楼 lostangel 发表于 2008-03-09 23:47
初级用户 发帖 7 积分 21 来自 河南
bat 变量的应用.不是很懂,谁给解释一下
@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楼 HAT 发表于 2008-03-10 00:27
版主 发帖 5,017 积分 9,023
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.
[ 联系联盟系统管理团队 - 中国DOS联盟 - 标准版 ]
Sponsored by ifanr Inc | © 2001–2023