Board logo

标题: [求助]变量应用 [打印本页]

作者: lonely203     时间: 2008-7-2 11:44    标题: [求助]变量应用
我想做一个BAT文件,功能是当在MS-DOS下面写open时就打开当前的目录,

但忙了半天还是没明白怎么变量,请个位帮忙,谢谢

应该是如下的代码,但是没学过DOS编程,所以不熟悉语法,

-------------
set %x = prompt $p

explorer %x
--------------

作者: pusofalse     时间: 2008-7-2 11:51
set/p x=
if "%x%" equ "open" start "" "%cd%"

作者: HAT     时间: 2008-7-2 12:02
尽快学会查看帮助


set /?

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.

作者: lonely203     时间: 2008-7-2 12:11
thanks ,用explorer %cd%就可以了,

作者: fastslz     时间: 2008-7-2 12:57
题外话
你所说的和MS-DOS无关,正确的说是CMD(命令提示符),请不要混淆

作者: danjiang     时间: 2008-7-2 14:23
最简单的命令。(一定要加上后面的点哦)
start.