中国DOS联盟

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

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

中国DOS联盟论坛
现在时间是 2026-06-28 01:15
中国DOS联盟论坛 » DOS疑难解答 & 问题讨论 (解答室) » 关于set指令 查看 585 回复 1
楼 主 关于set指令 发表于 2004-07-01 00:00 ·  中国 广西 桂林 电信
初级用户
积分 103
发帖 1
注册 2004-07-01 00:00
21年会员
UID 27643
性别 男
状态 离线
set/p xx=del c:\.>xx.bat

是什么意思呢?

请教
2 发表于 2004-07-02 00:00 ·  中国 河北 石家庄 联通
铂金会员
★★★★
网络独行侠
积分 6,962
发帖 2,753
注册 2003-04-16 00:00
23年会员
UID 1565
性别 男
来自 河北保定
状态 离线
你肯定是抄错了。
应该是这样的:
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
偶只喜欢回答那些标题和描述都很清晰的帖子!
如想解决问题,请认真学习“这个帖子”和“这个帖子”并努力遵守,如果可能,请告诉更多的人!
论坛跳转: