中国DOS联盟论坛

中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --
联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
游客 | 登录 | 注册 | 会员 | 搜索 | 中国DOS联盟
中国DOS联盟论坛
现在时间是 2026-08-16 19:12
47,813 主题排行 / 349,903 发帖 / 今日 0 篇 / 48,259 会员排行
DOS疑难解答 & 问题讨论 (解答室) » 关于set指令
可打印版本  625 / 1
第1楼 xuanliang 发表于 2004-07-01 00:00
初级用户 发帖 1 积分 103
关于set指令
set/p xx=del c:\.>xx.bat

是什么意思呢?

请教
第2楼 Climbing 发表于 2004-07-02 00:00
铂金会员 发帖 2,753 积分 6,962 来自 河北保定
你肯定是抄错了。
应该是这样的:
set /p xx=
del c:\.>xx.bat

/p参数的作用是将用户输入的一行内容作为环境变量的值,这应该是2000/xp/2003下dos窗口的set命令。不知道老版本的dos支持不支持这个参数。

Windows 2003下的set帮助(set /?):
...
Two new switches have been added to the SET command:

SET /A expression
SET /P variable=
...
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.

下面是我试用的过程:
C:\Documents and Settings\xxx>set /p xx=Please Input:
Please Input: del c:\.>x.bat
^^^^^^^^
系统自动提示内容

:: 显示xx环境变量的内容:
C:\Documents and Settings\xxx>set xx
xx= del c:\.>x.bat
[ 联系联盟系统管理团队 - 中国DOS联盟 - 标准版 ]
Sponsored by ifanr Inc | © 2001–2023