我记得可以这样做,而且我找到的文档表明应该$r
显示上一个命令的返回代码(又称“退出代码”)。当我尝试这样做时,提示符终止于$r
以下位置:
prompt $+$p$crc=$r$f$g
结果如下
C:\Temp(rc=
如果我$r
按如下方式删除,我会收到完整的提示:
prompt $+$p$crc=$f$g
C:\Temp(rc=)>
此功能是否已从 Windows 中删除?我是否需要“打开它”,或者我是否遗漏了什么?
答案1
这个功能已经从 Windows 中删除了吗?
$R
从来都不是 Windows shell 中提示文本的特殊代码cmd
。
要显示错误代码,请使用以下命令:
echo %errorlevel%
errorlevel
您可以设置提示以包含错误级别,但您会在设置提示时获得其值,因此它永远不会改变。
prompt %errorlevel%
笔记:
$R
在 OS/2 命令提示符中返回错误级别:
$R 错误级别 (OS/2)
帮助提示
Prompt can be made up of normal characters and the following special codes:
$A & (Ampersand)
$B | (pipe)
$C ( (Left parenthesis)
$D Current date
$E Escape code (ASCII code 27)
$F ) (Right parenthesis)
$G > (greater-than sign)
$H Backspace (erases previous character)
$L < (less-than sign)
$N Current drive
$P Current drive and path
$Q = (equal sign)
$S (space)
$T Current time
$V Windows version number
$_ Carriage return and linefeed
$$ $ (dollar sign)
If Command Extensions are enabled the PROMPT command supports
the following additional formatting characters:
$+ zero or more plus sign (+) characters depending upon the
depth of the PUSHD directory stack, one character for each
level pushed.
$M Displays the remote name associated with the current drive
letter or the empty string if current drive is not a network
drive.