|
我做了一些修改:
1. 在cmd.bat中,echo命令有时候不能正常工作。可能是由于第9行的if exist cmd && %cmd%,修改为if exist cmd %cmd%即可。
2.将run_cmd标签中的goto :%1 || exit修改为if not exist (bd)/boot/grub/%1 goto :%1 || exit。即如果(bd)/boot/grub/中存在与%1同名的外部命令,则优先执行它,否则执行cmd.bat的子命令。
- !BAT
- :Loop
- debug off
- pager off
- errorcheck off
- set cmd=
- set /p cmd=%@root%>
- debug off
- call :run_cmd %cmd%
- if exist cmd %cmd%
- goto :Loop
- :run_cmd
- if "%~1"=="" exit
- if not exist (bd)/boot/grub/%1 goto :%1 || exit
- exit
- :dir
- set cmd=ls %cmd:~3%
- exit
- :type
- set cmd=cat %cmd:~4%
- exit
- :cd
- set cmd=%2
- if not exist cmd && set cmd=echo %@root% && exit
- if "%cmd:~0,1%"=="(" && set cmd=root %cmd% && exit
- if "%cmd:~0,1%"=="/" && set cmd=root ()%cmd% && exit
- if not "%cmd%"==".." set cmd=root %@root%/%cmd% && exit
- set cmd=%@root%
- call :cd_up
- set cmd=root %cmd%
- exit
- :cd_up
- if "%cmd:~-1%"=="/" exit
- if "%cmd:~-1%"==")" exit
- set cmd=%cmd:~0,-1%
- goto :cd_up
复制代码 |
-
-
cmd.zip
395 Bytes, 下载次数: 18, 下载积分: 无忧币 -2
|