标题: [求助]请帮助解释此问题!
[打印本页]
作者: zhj85818
时间: 2007-11-26 07:51
标题: [求助]请帮助解释此问题!
@echo off
:loop
if "%1"==""goto done
prompt $e[%1m
echo on
echo off
prompt[$p]
cls
@echo off
rem set the named parameters textatter foregrounod
rem and background
if "%1"=="0" set textattr=0
if "%1"=="1" set textattr=1
if "%1"=="2" set textattr=2
if "%1"=="3" set textattr=3
if "%1"=="4" set textattr=4
if "%1"=="5" set textattr=5
if "%1"=="6" set textattr=6
if "%1"=="7" set textattr=7
if "%1"=="8" set textattr=8
if "%1"=="30" set foreground=30
if "%1"=="31" set foreground=31
if "%1"=="32" set foreground=32
if "%1"=="33" set foreground=33
if "%1"=="34" set foreground=34
if "%1"=="35" set foreground=35
if "%1"=="36" set foreground=36
if "%1"=="37" set foreground=37
if "%1"=="40" set background=40
if "%1"=="41" set background=41
if "%1"=="42" set background=42
if "%1"=="43" set background=43
if "%1"=="44" set background=44
if "%1"=="45" set background=45
if "%1"=="46" set background=46
if "%1"=="47" set background=47
if "%1"=="48" set background=48
if "%1"=="49" set background=49
shift
goto loop
:done
请帮助解释此程序!!
尤其是:
echo on
echo off
shift
在此程序中的作用
作者: lxmxn
时间: 2007-11-27 00:07
命令行查看其帮助,上面说得很清楚了。
echo /?
shift /?
作者: zhj85818
时间: 2007-11-27 18:18
请帮助解释一下在此程序中的作用
谢谢!
作者: lxmxn
时间: 2007-11-28 18:00
echo on 就是打开命令行命令的回显,而echo off就是关闭回显,你加上echo off和不加上运行试试就知道了。
shift 就是移动命令行参数的作用,就是%2变成%1,%3变成%2,依次类推。
建议多实践实践,实践出真知。
作者: zhj85818
时间: 2007-11-29 22:20
我知道了为什麽他开始关闭回显后来又打开然后又马上关闭了
我现在想问的是:
shift在if语句之后他把%1移动到%0的目的在那
请版忙解释
还有在cmd中是不是prompt命令改变不了屏幕颜色
也就是说prompt $e[%1m在cmd中根本实现不了
请帮忙解释
作者: loveheartrain
时间: 2007-11-30 21:58
COLOR 命令改变屏幕颜色