nekopack20110302save
2011-02-26 23:04:49
@echo off
if /i "%1"=="/nekolist" (echo NEKOPACK 查看,打包和安装 NekoScripts 命令集
goto eof)
if "%NekoScripts%"=="" (echo 找不到 NekoScripts 命令集,无法执行打包。
goto eof)
::main_segment
set stFileTemp=%temp%\%~n0.tmpx
call :_SetInit
if /i "%1"=="" goto LIST
if /i "%1"=="/?" goto HELP
set "stSelect=%1"
set "stSelect=%stSelect:~1%"
if /i "%stSelect%"=="help" goto HELP
if /i "%stSelect%"=="list" goto LIST
if /i "%stSelect%"=="pack" goto PACK
if /i "%stSelect%"=="clear" goto CLEAR
if /i "%stSelect%"=="extract" goto EXTRACT
goto LIST
:LIST
for /f "usebackq tokens=1,2,3,4 delims=:" %%i in ("%~f0") do (
if "%%i"=="nekopack" if "%%j"=="menu" (
set nmListA=%%k
set nmListB=%%l))
call :_PrintData %nmListA% %nmListB% noline
goto END
:HELP
echo Neko 命令集打包载体应用程序
echo.
echo -help 显示此命令,参数0
echo -list 显示已打包的命令,参数0
echo -pack 打包 NekoScripts 中命令文件,参数0
echo -clear 清除所有已打包的命令,参数0
echo -extract 释放已打包的命令,参数1[文件名或-all],参数2[路径]
goto END
:PACK
call :_RemoveData all
echo;NekoScripts 包中可用命令列表 更新于 %date%>"%stFileTemp%"
for /f %%i in ('dir "%NekoScripts%\*.cmd" /a:-d /b') do call %NekoScripts%\%%i /nekolist>>"%stFileTemp%"
call :CNTLINES "%stFileTemp%"
set /a nmLineCount+=1
call :_InsertData 0 "nekopack:menu:2:%nmLineCount%"
call :_InsertFile 1 "%stFileTemp%"
for /f %%i in ('dir "%NekoScripts%\*.cmd" /a:-d /b') do call :PACKFILE "%%i"
echo.
call :LIST
goto END
:CLEAR
call :_RemoveData all
goto END
:EXTRACT
set "stSelect=%2"
set stSelect=%stSelect:~1%
if /i "%stSelect%"=="all" (
for /f "usebackq tokens=1,2 delims=:" %%i in ("%~f0") do (
if "%%i"=="nekopack" if not "%%j"=="menu" call :EXTRACTFILE "%%j" "%3")
) else (call :EXTRACTFILE "%2" "%3")
goto END
:PACKFILE
if "%~1"=="%~nx0" goto eof
echo 正在打包:"%NekoScripts%\%~1"
call :COPYFILE "%NekoScripts%\%~1" "%stFileTemp%"
call :_GetDataCount
call :CNTLINES "%stFileTemp%"
set /a nmPackA=%_nmDataCount%+1
set /a nmPackB=%nmPackA%+1
set /a nmPackC=%nmPackA%+%nmLineCount%
call :_InsertData %_nmDataCount% "nekopack:%~n1:%nmPackB%:%nmPackC%"
call :_InsertFile %nmPackA% "%stFileTemp%"
goto eof
:EXTRACTFILE
if "%~2"=="" goto eof
if not "%~3"=="" goto eof
for /f "usebackq tokens=1,2,3,4 delims=:" %%i in ("%~f0") do (
if "%%i"=="nekopack" if "%%j"=="%~n1" (
set nmExtractA=%%k
set nmExtractB=%%l
set nmExtractC=EXIST))
if not "%nmExtractC%"=="EXIST" (echo '%~n1' 不存在。
goto eof)
if not exist "%~2" mkdir "%~2"
cd /d "%~2" >nul 2>nul
if %errorlevel% equ 1 goto eof
call :_GetDataSegLoc
set /a nmExtractA+=%_nmDataSegLocA%-1
set /a nmExtractB+=%_nmDataSegLocA%-1
set /a nmTempCount=0
cd.>".\%~n1.cmd"
echo 释放文件:"%~f1.cmd"
for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~f0"') do (set /a nmTempCount+=1
set "stTemp=%%i"
setlocal enabledelayedexpansion
if !nmTempCount! geq %nmExtractA% if !nmTempCount! leq %nmExtractB% (
echo;!stTemp:*:__=!>>".\%~n1.cmd")
endlocal)
goto eof
:COPYFILE
if "%~2"=="" goto eof
if exist "%~2" del /f "%~2"
cd.>"%~2"
for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~1"') do (
set "stTemp=%%i"
setlocal enabledelayedexpansion
echo;__!stTemp:*:=!>>"%~2"
endlocal)
goto eof
:CNTLINES
set /a nmLineCount=0
for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~1"') do set /a nmLineCount+=1
goto eof
:END
if not "%stFileTemp%"=="" if exist "%stFileTemp%" del /f "%stFileTemp%"
set stSelect=
set nmListA=
set nmListB=
set nmLineCount=
set nmTempCount=
set nmPackA=
set nmPackB=
set nmPackC=
set nmExtractA=
set nmExtractB=
set nmExtractC=
set stFileTemp=
set stTemp=
goto _SetClear
::main_ends
::code_segment
goto eof
:_PrintHelp
::syntax _void :return _return(_GetCodeSegLoc)
call :_GetCodeSegLoc
set /a _nmTempCount=0
for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~f0"') do (set /a _nmTempCount+=1
set "_stTempOri=%%i"
setlocal enabledelayedexpansion
set "_stTempOri=!_stTempOri:*:=!"
if !_nmTempCount! geq %_nmCodeSegLocA% if !_nmTempCount! leq %_nmCodeSegLocB% (
set "_stTempIns=!_stTempOri:~0,1!"
set "_stTempOri=!_stTempOri:~1!"
if "!_stTempIns!"==":" echo !_stTempOri!
)
endlocal)
goto eof
:_SetInit
::syntax _void :return _stNekoVer, _stFileTemp, _stFindStrCmd
set _stNekoVer=20110226
set _stFileTemp=%temp%\%~n0.tmp
set _stFindStrCmd=findstr /i /n
goto eof
:_SetClear
::syntax _void :return _void
set _nmTempDataLoc=
set _nmTempCount=
set _nmTempInsStart=
set _nmTempInsLoc=
set _stTempIns=
set _stTempOri=
set _nmTempRemoveA=
set _nmTempRemoveB=
set _nmTempPrintA=
set _nmTempPrintB=
set _nmTempUpdateA=
set _nmTempUpdateB=
if not "%_stFileTemp%"=="" if exist "%_stFileTemp%" del /f "%_stFileTemp%"
set _stNekoVer=
set _stFileTemp=
set _stFindStrCmd=
set _nmCodeSegLocA=
set _nmCodeSegLocB=
set _nmDataSegLocA=
set _nmDataSegLocB=
set _nmDataCount=
set _nmFindData=
set _stData=
goto eof
:_GetCodeSegLoc
::syntax _void :return _nmAbs(_nmCodeSegLocA), _nmAbs(_nmCodeSegLocB)
for /f "delims=:" %%i in ('%_stFindStrCmd% /x /c:"::code_segment" "%~f0"') do set /a _nmCodeSegLocA=%%i+1
for /f "delims=:" %%i in ('%_stFindStrCmd% /x /c:"::code_ends" "%~f0"') do set /a _nmCodeSegLocB=%%i-1
goto eof
:_GetDataSegLoc
::syntax _void :return _nmAbs(_nmDataSegLocA), _nmAbs(_nmDataSegLocB)
for /f "delims=:" %%i in ('%_stFindStrCmd% /x /c:"::data_segment" "%~f0"') do set /a _nmDataSegLocA=%%i+1
for /f "delims=:" %%i in ('%_stFindStrCmd% /x /c:"::data_ends" "%~f0"') do set /a _nmDataSegLocB=%%i-1
goto eof
:_GetDataCount
::syntax _void :return _return(_GetDataSegLoc), _nmRel(_nmDataCount)
call :_GetDataSegLoc
set /a _nmDataCount=1+%_nmDataSegLocB%-%_nmDataSegLocA%
goto eof
:_FindData
::syntax _st(%~1) :return _nmAbs(_nmFindData)
set /a _nmFindData=0
for /f "delims=:" %%i in ('%_stFindStrCmd% /x /c:"%~1" "%~f0"') do set /a _nmFindData=%%i
goto eof
:_GetData
::syntax _nmRel(%~1) :return _return(_GetDataCount), _stData
call :_GetDataCount
if %~1 lss 1 goto eof
if %~1 gtr %_nmDataCount% goto eof
set /a _nmTempDataLoc=%~1+%_nmDataSegLocA%-1
set /a _nmTempCount=0
for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~f0"') do (set /a _nmTempCount+=1
set "_stTempOri=%%i"
setlocal enabledelayedexpansion
if !_nmTempCount! equ %_nmTempDataLoc% echo;!_stTempOri:*:=!>"%_stFileTemp%"
endlocal)
for /f "usebackq delims=" %%i in ("%_stFileTemp%") do set "_stData=%%i"
goto eof
:_InsertData
::syntax _nmRel(%~1), _st(%~2) :return _return(_GetDataSegLoc)
call :_GetDataSegLoc
set /a _nmTempInsStart=%_nmDataSegLocA%-1
set /a _nmTempInsLoc=%~1+%_nmDataSegLocA%-1
if %_nmTempInsLoc% lss %_nmTempInsStart% goto eof
if %_nmTempInsLoc% gtr %_nmDataSegLocB% goto eof
set "_stTempIns=%~1:%~2"
cd.>"%_stFileTemp%"
set /a _nmTempCount=0
for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~f0"') do (set /a _nmTempCount+=1
set "_stTempOri=%%i"
setlocal enabledelayedexpansion
if !_nmTempCount! leq %_nmTempInsLoc% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
if !_nmTempCount! equ %_nmTempInsLoc% echo;!_stTempIns:*:=!>>"%_stFileTemp%"
if !_nmTempCount! gtr %_nmTempInsLoc% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
endlocal)
type "%_stFileTemp%">"%~f0"
goto eof
:_InsertFile
::syntax _nmRel(%~1), _st(%~2) :return _return(_GetDataSegLoc)
call :_GetDataSegLoc
set /a _nmTempInsStart=%_nmDataSegLocA%-1
set /a _nmTempInsLoc=%~1+%_nmDataSegLocA%-1
if %_nmTempInsLoc% lss %_nmTempInsStart% goto eof
if %_nmTempInsLoc% gtr %_nmDataSegLocB% goto eof
if not exist "%~2" goto eof
set "_stTempIns=%~2"
cd.>"%_stFileTemp%"
set /a _nmTempCount=0
for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~f0"') do (set /a _nmTempCount+=1
set "_stTempOri=%%i"
setlocal enabledelayedexpansion
if !_nmTempCount! leq %_nmTempInsLoc% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
if !_nmTempCount! equ %_nmTempInsLoc% type "%_stTempIns%">>"%_stFileTemp%"
if !_nmTempCount! gtr %_nmTempInsLoc% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
endlocal)
type "%_stFileTemp%">"%~f0"
goto eof
:_RemoveData
::syntax _st(%~1), _nmRel(%~1), _nmRel(%~2) :return _return(_GetDataSegLoc)
call :_GetDataSegLoc
if /i "%~1"=="all" (set /a _nmTempRemoveA=%_nmDataSegLocA%
set /a _nmTempRemoveB=%_nmDataSegLocB%
) else (set /a _nmTempRemoveA=%~1+%_nmDataSegLocA%-1
set /a _nmTempRemoveB=%~2+%_nmDataSegLocA%-1)
if %_nmTempRemoveA% lss %_nmDataSegLocA% goto eof
if %_nmTempRemoveA% gtr %_nmDataSegLocB% goto eof
if %_nmTempRemoveB% lss %_nmDataSegLocA% goto eof
if %_nmTempRemoveB% gtr %_nmDataSegLocB% goto eof
if %_nmTempRemoveA% gtr %_nmTempRemoveB% goto eof
cd.>"%_stFileTemp%"
set /a _nmTempCount=0
for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~f0"') do (set /a _nmTempCount+=1
set "_stTempOri=%%i"
setlocal enabledelayedexpansion
if !_nmTempCount! lss %_nmTempRemoveA% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
if !_nmTempCount! gtr %_nmTempRemoveB% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
endlocal)
type "%_stFileTemp%">"%~f0"
goto eof
:_PrintData
::syntax _st(%~1), _nmRel(%~1), _st(%~2), _nmRel(%~2), _st(%~3) :return _return(_GetDataSegLoc)
call :_GetDataSegLoc
if /i "%~1"=="all" (set /a _nmTempPrintA=%_nmDataSegLocA%
set /a _nmTempPrintB=%_nmDataSegLocB%
) else (set /a _nmTempPrintA=%~1+%_nmDataSegLocA%-1
set /a _nmTempPrintB=%~2+%_nmDataSegLocA%-1)
if %_nmTempPrintA% lss %_nmDataSegLocA% goto eof
if %_nmTempPrintA% gtr %_nmDataSegLocB% goto eof
if %_nmTempPrintB% lss %_nmDataSegLocA% goto eof
if %_nmTempPrintB% gtr %_nmDataSegLocB% goto eof
if %_nmTempPrintA% gtr %_nmTempPrintB% goto eof
set /a _nmTempCount=0
for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~f0"') do (set /a _nmTempCount+=1
set "_stTempOri=%%i"
setlocal enabledelayedexpansion
if !_nmTempCount! geq %_nmTempPrintA% if !_nmTempCount! leq %_nmTempPrintB% (
set /a _nmTempCount=!_nmTempCount!-%_nmDataSegLocA%+1
if /i "%~3"=="noline" (echo;!_stTempOri:*:=!) else (echo;!_nmTempCount! !_stTempOri:*:=!))
endlocal)
goto eof
:_WriteCode
::syntax _st(%~1) :return _void
call :_GetCodeSegLoc
if not exist "%~1" goto eof
if /i "%~1"=="%~f0" goto eof
set _nmTempUpdateA=
set _nmTempUpdateB=
for /f "delims=:" %%i in ('%_stFindStrCmd% /x /c:"::code_segment" "%~1"') do set /a _nmTempUpdateA=%%i+1
for /f "delims=:" %%i in ('%_stFindStrCmd% /x /c:"::code_ends" "%~1"') do set /a _nmTempUpdateB=%%i-1
if "%_nmTempUpdateA%"=="" goto eof
if "%_nmTempUpdateB%"=="" goto eof
if %_nmTempUpdateA% geq %_nmTempUpdate% goto eof
cd.>"%_stFileTemp%"
set /a _nmTempCount=0
for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~1"') do (set /a _nmTempCount+=1
set "_stTempOri=%%i"
setlocal enabledelayedexpansion
if !_nmTempCount! lss %_nmTempUpdateA% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
endlocal)
set /a _nmTempCount=0
for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~f0"') do (set /a _nmTempCount+=1
set "_stTempOri=%%i"
setlocal enabledelayedexpansion
if !_nmTempCount! geq %_nmCodeSegLocA% if !_nmTempCount! leq %_nmCodeSegLocB% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
endlocal)
set /a _nmTempCount=0
for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~1"') do (set /a _nmTempCount+=1
set "_stTempOri=%%i"
setlocal enabledelayedexpansion
if !_nmTempCount! gtr %_nmTempUpdateB% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
endlocal)
type "%_stFileTemp%">"%~1"
goto eof
::code_ends
::data_segment
nekopack:menu:2:34
NekoScripts 包中可用命令列表 更新于 2011/03/02 周三
ATTPM 快速设置文件/文件夹系统属性
BRMOUNT 磁盘卷备份/恢复向导
CE 循环执行程序
CLEAR 清除屏幕
CLOCK 电子表
CNTLINES 文本文件行数统计
DATA 数据程序示例
DELSUBST 清除所有由 SUBST 命令指派的驱动器
DIRCOMP 目录结构比较工具
EDIT 文本文件编辑器
FCOPY 末尾强制标准化文本文件复制
FLSKV 可移动磁盘防病毒扫描程序
GLASSCMD 启用命令提示符磨砂玻璃效果
IPV6 快速设置交大校内 IPv6 翻墙站点
J 文件夹快速跳跃工具
LL 列表查看目录和文件
M4 启动 4 个 MPICH2 并行进程
MYCMD 命令提示符
N 快速打开和编辑文本文件
NEKOPACK 查看,打包和安装 NekoScripts 命令集
O 快速打开文件夹
X 执行命令并退出命令行
READ 文本分页显示工具
SCDEDIT 隐藏目录数据存储编辑器
SETNTSHELL 更改 Windows NT Shell
SHOW_PERCENT 进度条演示程序
SHOW_TITLE 标题动画演示
SHOW_WINXP Windows XP 启动进度条演示
SPLITEXT 文本文件分割工具
SRCHSTR 字符串搜索工具
VDIR 文件夹判断程序
X 执行命令并退出命令行
nekopack:attpm:36:65
__@echo off
__if /i "%*"=="/nekolist" (echo ATTPM 快速设置文件/文件夹系统属性
__goto EOF)
__if "%2"=="" goto NOSYNX
__if /i "%1"=="+" goto ADD
__if /i "%1"=="-" goto REMOVE
__goto ERSYNX
__
__:NOSYNX
__echo 命令格式
__echo attpm + [filename] 快速添加系统文件属性
__echo attpm - [filename] 快速删除系统文件属性
__goto EOF
__
__:ADD
__echo 文件:%2
__attrib %2 +s +h +r -a
__goto DONE
__
__:REMOVE
__echo 文件:%2
__attrib %2 -s -h -r -a
__goto DONE
__
__:DONE
__echo.
__echo 操作成功完成。
__goto EOF
__
__:EOF
nekopack:brmount:67:449
__@echo off
__rem Shanghai Jiaotong University
__rem Coded by Neko, 2007-2011. All rights reserved.
__rem ==============================================
__if /i "%*"=="/nekolist" (echo BRMOUNT 磁盘卷备份/恢复向导
__goto EOF)
__if exist %SystemRoot%\System32\BRMWIZ32.EXE goto GUI
__set xmver=2.00.6225
__set XMTA=磁盘卷 备份/恢复 向导 [版本 %xmver%]
__set XMTBak=磁盘卷备份向导 [版本 %xmver%]
__set XMTRec=磁盘卷恢复向导 [版本 %xmver%]
__set XMTB=Coded by neko, 2007. All rights reserved.
__cls
__echo %XMTA%
__echo %XMTB%
__set XMTA=
__echo.
__echo 此向导只能在管理员级别的命令提示符下执行。
__echo 要强制结束处理进程,请按组合键 Ctrl+C 。
__echo.
__goto ChosTask
__:ChosTask
__set /p BR="请选择一项任务[1=备份 2=恢复 3=退出]: "
__if "%BR%"=="" goto ChosTask
__if "%BR%"=="1" goto Bak01
__if "%BR%"=="2" goto Rec01
__if "%BR%"=="3" goto EOF
__goto ChosTask
__:Bak01
__set BR=
__set XMTRec=
__cls
__echo %XMTBak%
__echo %XMTB%
__echo.
__goto GetBakDr
__:GetBakDr
__rem 获取源卷盘符。
__set BakDrv=
__set /p BakDrv="请输入要备份的卷的盘符: "
__if "%BakDrv%"=="" goto GetBakDr
__if exist %BakDrv%: (
__for /f "tokens=1 delims=:" %%x in ("%Systemroot%") do @if %%x==%BakDrv% (
__echo 该卷是当前系统所在的分区,不能执行备份。请重新指定。
__goto GetBakDr
__) else (
__echo.
__goto TrgWIMF
__)
__) else (
__echo 卷 %BakDrv%: 不存在。
__)
__goto GetBakDr
__:TrgWIMF
__rem 获取目标文件位置。
__set TrgWF=
__set /p TrgWF="请指定要保存的镜像文件的地址和文件名: "
__if "%TrgWF%"=="" goto TrgWIMF
__if exist %TrgWF% (
__echo.
__echo 目标文件已经存在。
__goto TWFExs
__) else (
__echo Test This WIM File >>%TrgWF%
__if not exist %TrgWF% (
__goto TrgWIMF
__) else (
__set DWEF=0
__del %TrgWF%
__goto GetDesc
__)
__)
__goto TrgWIMF
__:TWFExs
__set DWEF=
__set /p DWEF="请选择[1=覆盖文件 2=添加为子集 3=重新指定]: "
__if "%DWEF%"=="" goto TWFExs
__if "%DWEF%"=="3" goto TrgWIMF
__if "%DWEF%"=="1" goto GetDesc
__if "%DWEF%"=="2" goto GetDesc
__goto TWFExs
__:GetDesc
__echo.
__set /p BDesc="请输入镜像文件的描述语: "
__if "%BDesc%"=="" goto GetDesc
__echo.
__echo 扫描待备份的卷可以卸下该卷并检查磁盘错误。
__goto ChkBDrv
__goto GetDesc
__:ChkBDrv
__set BScan=
__set /p BScan="是否扫描卷 %BakDrv%: [Y/N]? "
__if "%BScan%"=="" goto ChkBDrv
__echo.
__goto MSBInf
__:MSBInf
__if "%BScan%"=="Y" (set BSDes=是) else (set BSDes=否)
__if "%BScan%"=="y" (set BSDes=是) else (set BSDes=否)
__set BScan=
__cls
__echo %XMTBak%
__echo %XMTB%
__echo.
__echo 确认信息
__echo ==========
__echo 待备份的卷 %BakDrv%:
__echo 扫描目标卷 %BSDes%
__echo 目标文件 %TrgWF%
__if %DWEF%==1 echo [目标文件已存在,将其覆盖]
__if %DWEF%==2 echo [目标文件已存在,将向该文件中添加一个镜像子集]
__echo 镜像描述语 %BDesc%
__echo.
__goto MSBYN
__:MSBYN
__set BakYN=
__set /p BakYN="是否开始备份[Y/N]? "
__if "%BakYN%"=="" goto MSBYN
__if "%BakYN%"=="Y" goto StartBak
__if "%BakYN%"=="y" goto StartBak
__if "%BakYN%"=="N" goto EOF
__if "%BakYN%"=="n" goto EOF
__goto MSBYN
__:StartBak
__if %BSDes%==否 goto IBak
__if %BSDes%==是 goto ChkBD
__goto EOF
__:ChkBD
__cls
__echo %XMTBak%
__echo %XMTB%
__echo.
__echo 正在执行:扫描卷 %BakDrv%: ...
__echo.
__rem ******
__CHKDSK %BakDrv%: /R /X
__echo.
__goto IBak
__:IBak
__cls
__echo %XMTBak%
__echo %XMTB%
__echo.
__echo 正在执行:备份卷 %BakDrv%: ...
__echo.
__rem ******
__set XMTA=
__set XMTBak=
__set XMTRec=
__set XMTB=
__set BR=
__set BScan=
__set BSDes=
__if %DWEF%==2 ImageX /compress max /append %BakDrv%: %TrgWF% "%BDesc%"
__if %DWEF%==0 ImageX /compress max /capture %BakDrv%: %TrgWF% "%BDesc%"
__if %DWEF%==1 ImageX /compress max /capture %BakDrv%: %TrgWF% "%BDesc%"
__echo.
__goto ChkBR
__:ChkBR
__if exist %TrgWF% echo 备份完成。
__if not exist %TrgWF% echo 备份失败。
__goto EOF
__:Rec01
__set BR=
__set XMTBak=
__cls
__echo %XMTRec%
__echo %XMTB%
__echo.
__goto GetWIMF
__:GetWIMF
__set SourF=
__set /p SourF="请指定镜像文件的地址: "
__if "%SourF%"=="" goto GetWIMF
__if not exist %SourF% (
__echo 文件不存在。请重新指定。
__) else (
__echo.
__goto WIMIndex
__)
__goto GetWIMF
__:WIMIndex
__set WIMInd=
__set /p WIMInd="请选择镜像文件子集序号[通常为 1 ]: "
__if "%WIMInd%"=="" goto WIMIndex
__echo.
__goto GetRecDr
__:GetRecDr
__set RecDrv=
__set /p RecDrv="请输入要恢复的卷的盘符: "
__if "%RecDrv%"=="" goto GetRecDr
__if exist %RecDrv%: (
__for /f "tokens=1 delims=:" %%x in ("%Systemroot%") do @if %%x==%RecDrv% (
__echo 该卷是当前系统所在的分区,不能执行备份。请重新指定。
__goto GetRecDr
__) else (
__echo.
__goto ShowCF
__)
__) else (
__echo 卷 %RecDrv%: 不存在。
__goto GetRecDr
__)
__goto GetRecDr
__:ShowCF
__cls
__echo %XMTRec%
__echo %XMTB%
__echo.
__echo 格式化选项
__echo ==========
__echo 0 = 不格式化
__echo 1 = 格式化为 NTFS
__echo 2 = 快速格式化为 NTFS
__echo 3 = 格式化为 FAT
__echo 4 = 快速格式化为 FAT
__echo 5 = 格式化为 FAT32
__echo 6 = 快速格式化为 FAT32
__echo.
__goto RecFmt
__:RecFmt
__set FmtFS=
__set /p FmtFS="请选择格式化方案: "
__if "%FmtFS%"=="" goto RecFmt
__if "%FmtFS%"=="0" set FmtDz=不格式化该卷
__if "%FmtFS%"=="1" set FmtDz=格式化为 NTFS
__if "%FmtFS%"=="2" set FmtDz=快速格式化为 NTFS
__if "%FmtFS%"=="3" set FmtDz=格式化为 FAT
__if "%FmtFS%"=="4" set FmtDz=快速格式化为 FAT
__if "%FmtFS%"=="5" set FmtDz=格式化为 FAT32
__if "%FmtFS%"=="6" set FmtDz=快速格式化为 FAT32
__echo.
__if %FmtFS%==0 goto RecBoot
__if %FmtFS%==1 goto RecBoot
__if %FmtFS%==2 goto RecBoot
__if %FmtFS%==3 goto RecBoot
__if %FmtFS%==4 goto RecBoot
__if %FmtFS%==5 goto RecBoot
__if %FmtFS%==6 goto RecBoot
__goto RecFmt
__:RecBoot
__set WRecB=
__set /p WRecB="是否向该卷写入引导数据[Y/N]? "
__if "%WRecB%"=="" goto RecBoot
__if "%WRecB%"=="Y" set WBoot=是
__if "%WRecB%"=="y" set WBoot=是
__if "%WRecB%"=="N" set WBoot=否
__if "%WRecB%"=="n" set WBoot=否
__if "%WRecB%"=="Y" goto IChkRec
__if "%WRecB%"=="y" goto IChkRec
__if "%WRecB%"=="N" goto IChkRec
__if "%WRecB%"=="n" goto IChkRec
__goto RecBoot
__:IChkRec
__if not %FmtFS%==0 goto StartRec
__set iCRec=
__set /p iCRec="是否在恢复卷之前扫描磁盘[Y/N]? "
__if "%iCRec%"=="Y" set CRec=是
__if "%iCRec%"=="y" set CRec=是
__if "%iCRec%"=="N" set CRec=否
__if "%iCRec%"=="n" set CRec=否
__if %CRec%==是 goto StartRec
__if %CRec%==否 goto StartRec
__goto IChkRec
__:StartRec
__if "%CRec%"=="" set CRec=Blank
__cls
__echo %XMTRec%
__echo %XMTB%
__echo.
__echo 确认信息
__echo ==========
__echo 待恢复的卷 %RecDrv%:
__echo %FmtDz%
__if %CRec%==否 echo 扫描磁盘 否
__if %CRec%==是 echo 扫描磁盘 是
__echo 写入引导数据 %WBoot%
__echo 镜像文件 %SourF%
__echo 子集序号 %WIMInd%
__echo.
__set FmtDz=
__set ChkRec=
__goto MSRYN
__:MSRYN
__set RecYN=
__set /p RecYN="是否开始恢复数据[Y/N]? "
__if "%RecYN%"=="" goto MSRYN
__if "%RecYN%"=="Y" goto StartRec
__if "%RecYN%"=="y" goto StartRec
__if "%RecYN%"=="N" goto EOF
__if "%RecYN%"=="n" goto EOF
__goto MSRYN
__:StartRec
__if %FmtFS%==0 goto StrCR
__cls
__echo %XMTRec%
__echo %XMTB%
__echo.
__echo 正在执行:格式化卷 %RecDrv%: ...
__echo.
__rem ******
__if %FmtFS%==1 format %RecDrv%: /fs:ntfs /x
__if %FmtFS%==2 format %RecDrv%: /fs:ntfs /q /x
__if %FmtFS%==3 format %RecDrv%: /fs:fat /x
__if %FmtFS%==4 format %RecDrv%: /fs:fat /q /x
__if %FmtFS%==5 format %RecDrv%: /fs:fat32 /x
__if %FmtFS%==6 format %RecDrv%: /fs:fat32 /q /x
__goto IMRec
__:StrCR
__if %CRec%==否 goto IMRec
__cls
__echo %XMTRec%
__echo %XMTB%
__echo.
__echo 正在执行:扫描卷 %RecDrv%: ...
__echo.
__rem ******
__chkdsk %RecDrv%: /R /X
__goto IMRec
__chkdsk %RecDrv%
__:IMRec
__cls
__echo %XMTRec%
__echo %XMTB%
__echo.
__echo 正在执行:恢复数据到卷 %RecDrv%: ...
__echo.
__rem ******
__ImageX /apply %SourF% %WIMInd% %RecDrv%:
__if %WBoot%==否 (
__echo 执行完毕。
__goto EOF
__) else (
__goto Wrb
__)
__goto Wrb
__:Wrb
__cls
__echo %XMTRec%
__echo %XMTB%
__echo.
__echo 正在执行:写入引导数据到卷 %RecDrv%: ...
__echo.
__rem ******
__if not exist %RecDrv%:\bootmgr (
__if not exist %RecDrv%:\ntldr (
__echo.
__echo 卷 %RecDrv%: 没有可用的引导文件。
__goto EOF
__)
__)
__if exist %RecDrv%:\bootmgr Bootsect /nt60 %RecDrv%:
__if exist %RecDrv%:\ntldr Bootsect /nt52 %RecDrv%:
__echo.
__echo 执行完毕。
__goto EOF
__:GUI
__%SystemRoot%\System32\BRMWIZ32.EXE
__goto EOF
__
__:EOF
__set XMTA=
__set XMTBak=
__set XMTRec=
__set XMTB=
__set xmver=
__set BR=
__set BakDrv=
__set TrgWF=
__set DWEF=
__set BDesc=
__set BScan=
__set BSDes=
__set BakYN=
__set SourF=
__set FmtFS=
__set FmtDz=
__set WRecB=
__set ChkRec=
__set WBoot=
__set iCRec=
__set CRec=
__set WIMInd=
__set RecYN=
nekopack:ce:451:463
__::循环执行程序
__::Coded by neko, 2010. All rights reserved.
__
__@echo off
__if /i "%*"=="/nekolist" (echo CE 循环执行程序
__goto EOF)
__goto BEGIN
__
__:BEGIN
__call %*
__goto BEGIN
__
__:EOF
nekopack:clear:465:471
__@echo off
__if /i "%*"=="/nekolist" (echo CLEAR 清除屏幕
__goto EOF)
__cls %*
__goto EOF
__
__:EOF
nekopack:clock:473:482
__@echo off
__if /i "%*"=="/nekolist" (echo CLOCK 电子表
__goto EOF)
__call glasscmd.cmd
__mode con:cols=16 lines=2
__echo %date%
__:START
__for /f "delims=. tokens=1" %%i in ("%time%") do set /p=%%i<nul
__goto START
__:EOF
nekopack:cntlines:484:499
__::文本文件行数统计
__::Coded by neko, 2010. All rights reserved.
__
__@echo off
__if /i "%*"=="/nekolist" (echo CNTLINES 文本文件行数统计
__goto EOF)
__if "%1"=="" (echo 未指定文件。
__goto EOF)
__if not exist "%1" goto EOF
__set nmLineCount=0
__for /f "delims=" %%i in ('findstr /n .* %1') do set /a nmLineCount+=1
__echo %nmLineCount% %1
__set nmLineCount=
__goto EOF
__
__:EOF
nekopack:data:501:717
__@echo off
__if /i "%1"=="/nekolist" (echo DATA 数据程序示例
__goto eof)
__
__::main_segment
__call :_SetInit
__call :_%*
__call :_SetClear
__::main_ends
__
__::code_segment
__goto eof
__:_PrintHelp
__::syntax _void :return _return(_GetCodeSegLoc)
__call :_GetCodeSegLoc
__set /a _nmTempCount=0
__for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~f0"') do (set /a _nmTempCount+=1
__set "_stTempOri=%%i"
__setlocal enabledelayedexpansion
__set "_stTempOri=!_stTempOri:*:=!"
__if !_nmTempCount! geq %_nmCodeSegLocA% if !_nmTempCount! leq %_nmCodeSegLocB% (
__set "_stTempIns=!_stTempOri:~0,1!"
__set "_stTempOri=!_stTempOri:~1!"
__if "!_stTempIns!"==":" echo !_stTempOri!
__)
__endlocal)
__goto eof
__:_SetInit
__::syntax _void :return _stNekoVer, _stFileTemp, _stFindStrCmd
__set _stNekoVer=20110226
__set _stFileTemp=%temp%\%~n0.tmp
__set _stFindStrCmd=findstr /i /n
__goto eof
__:_SetClear
__::syntax _void :return _void
__set _nmTempDataLoc=
__set _nmTempCount=
__set _nmTempInsStart=
__set _nmTempInsLoc=
__set _stTempIns=
__set _stTempOri=
__set _nmTempRemoveA=
__set _nmTempRemoveB=
__set _nmTempPrintA=
__set _nmTempPrintB=
__set _nmTempUpdateA=
__set _nmTempUpdateB=
__if not "%_stFileTemp%"=="" if exist "%_stFileTemp%" del /f "%_stFileTemp%"
__set _stNekoVer=
__set _stFileTemp=
__set _stFindStrCmd=
__set _nmCodeSegLocA=
__set _nmCodeSegLocB=
__set _nmDataSegLocA=
__set _nmDataSegLocB=
__set _nmDataCount=
__set _nmFindData=
__set _stData=
__goto eof
__:_GetCodeSegLoc
__::syntax _void :return _nmAbs(_nmCodeSegLocA), _nmAbs(_nmCodeSegLocB)
__for /f "delims=:" %%i in ('%_stFindStrCmd% /x /c:"::code_segment" "%~f0"') do set /a _nmCodeSegLocA=%%i+1
__for /f "delims=:" %%i in ('%_stFindStrCmd% /x /c:"::code_ends" "%~f0"') do set /a _nmCodeSegLocB=%%i-1
__goto eof
__:_GetDataSegLoc
__::syntax _void :return _nmAbs(_nmDataSegLocA), _nmAbs(_nmDataSegLocB)
__for /f "delims=:" %%i in ('%_stFindStrCmd% /x /c:"::data_segment" "%~f0"') do set /a _nmDataSegLocA=%%i+1
__for /f "delims=:" %%i in ('%_stFindStrCmd% /x /c:"::data_ends" "%~f0"') do set /a _nmDataSegLocB=%%i-1
__goto eof
__:_GetDataCount
__::syntax _void :return _return(_GetDataSegLoc), _nmRel(_nmDataCount)
__call :_GetDataSegLoc
__set /a _nmDataCount=1+%_nmDataSegLocB%-%_nmDataSegLocA%
__goto eof
__:_FindData
__::syntax _st(%~1) :return _nmAbs(_nmFindData)
__set /a _nmFindData=0
__for /f "delims=:" %%i in ('%_stFindStrCmd% /x /c:"%~1" "%~f0"') do set /a _nmFindData=%%i
__goto eof
__:_GetData
__::syntax _nmRel(%~1) :return _return(_GetDataCount), _stData
__call :_GetDataCount
__if %~1 lss 1 goto eof
__if %~1 gtr %_nmDataCount% goto eof
__set /a _nmTempDataLoc=%~1+%_nmDataSegLocA%-1
__set /a _nmTempCount=0
__for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~f0"') do (set /a _nmTempCount+=1
__set "_stTempOri=%%i"
__setlocal enabledelayedexpansion
__if !_nmTempCount! equ %_nmTempDataLoc% echo;!_stTempOri:*:=!>"%_stFileTemp%"
__endlocal)
__for /f "usebackq delims=" %%i in ("%_stFileTemp%") do set "_stData=%%i"
__goto eof
__:_InsertData
__::syntax _nmRel(%~1), _st(%~2) :return _return(_GetDataSegLoc)
__call :_GetDataSegLoc
__set /a _nmTempInsStart=%_nmDataSegLocA%-1
__set /a _nmTempInsLoc=%~1+%_nmDataSegLocA%-1
__if %_nmTempInsLoc% lss %_nmTempInsStart% goto eof
__if %_nmTempInsLoc% gtr %_nmDataSegLocB% goto eof
__set "_stTempIns=%~1:%~2"
__cd.>"%_stFileTemp%"
__set /a _nmTempCount=0
__for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~f0"') do (set /a _nmTempCount+=1
__set "_stTempOri=%%i"
__setlocal enabledelayedexpansion
__if !_nmTempCount! leq %_nmTempInsLoc% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
__if !_nmTempCount! equ %_nmTempInsLoc% echo;!_stTempIns:*:=!>>"%_stFileTemp%"
__if !_nmTempCount! gtr %_nmTempInsLoc% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
__endlocal)
__type "%_stFileTemp%">"%~f0"
__goto eof
__:_InsertFile
__::syntax _nmRel(%~1), _st(%~2) :return _return(_GetDataSegLoc)
__call :_GetDataSegLoc
__set /a _nmTempInsStart=%_nmDataSegLocA%-1
__set /a _nmTempInsLoc=%~1+%_nmDataSegLocA%-1
__if %_nmTempInsLoc% lss %_nmTempInsStart% goto eof
__if %_nmTempInsLoc% gtr %_nmDataSegLocB% goto eof
__if not exist "%~2" goto eof
__set "_stTempIns=%~2"
__cd.>"%_stFileTemp%"
__set /a _nmTempCount=0
__for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~f0"') do (set /a _nmTempCount+=1
__set "_stTempOri=%%i"
__setlocal enabledelayedexpansion
__if !_nmTempCount! leq %_nmTempInsLoc% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
__if !_nmTempCount! equ %_nmTempInsLoc% type "%_stTempIns%">>"%_stFileTemp%"
__if !_nmTempCount! gtr %_nmTempInsLoc% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
__endlocal)
__type "%_stFileTemp%">"%~f0"
__goto eof
__:_RemoveData
__::syntax _st(%~1), _nmRel(%~1), _nmRel(%~2) :return _return(_GetDataSegLoc)
__call :_GetDataSegLoc
__if /i "%~1"=="all" (set /a _nmTempRemoveA=%_nmDataSegLocA%
__set /a _nmTempRemoveB=%_nmDataSegLocB%
__) else (set /a _nmTempRemoveA=%~1+%_nmDataSegLocA%-1
__set /a _nmTempRemoveB=%~2+%_nmDataSegLocA%-1)
__if %_nmTempRemoveA% lss %_nmDataSegLocA% goto eof
__if %_nmTempRemoveA% gtr %_nmDataSegLocB% goto eof
__if %_nmTempRemoveB% lss %_nmDataSegLocA% goto eof
__if %_nmTempRemoveB% gtr %_nmDataSegLocB% goto eof
__if %_nmTempRemoveA% gtr %_nmTempRemoveB% goto eof
__cd.>"%_stFileTemp%"
__set /a _nmTempCount=0
__for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~f0"') do (set /a _nmTempCount+=1
__set "_stTempOri=%%i"
__setlocal enabledelayedexpansion
__if !_nmTempCount! lss %_nmTempRemoveA% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
__if !_nmTempCount! gtr %_nmTempRemoveB% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
__endlocal)
__type "%_stFileTemp%">"%~f0"
__goto eof
__:_PrintData
__::syntax _st(%~1), _nmRel(%~1), _st(%~2), _nmRel(%~2), _st(%~3) :return _return(_GetDataSegLoc)
__call :_GetDataSegLoc
__if /i "%~1"=="all" (set /a _nmTempPrintA=%_nmDataSegLocA%
__set /a _nmTempPrintB=%_nmDataSegLocB%
__) else (set /a _nmTempPrintA=%~1+%_nmDataSegLocA%-1
__set /a _nmTempPrintB=%~2+%_nmDataSegLocA%-1)
__if %_nmTempPrintA% lss %_nmDataSegLocA% goto eof
__if %_nmTempPrintA% gtr %_nmDataSegLocB% goto eof
__if %_nmTempPrintB% lss %_nmDataSegLocA% goto eof
__if %_nmTempPrintB% gtr %_nmDataSegLocB% goto eof
__if %_nmTempPrintA% gtr %_nmTempPrintB% goto eof
__set /a _nmTempCount=0
__for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~f0"') do (set /a _nmTempCount+=1
__set "_stTempOri=%%i"
__setlocal enabledelayedexpansion
__if !_nmTempCount! geq %_nmTempPrintA% if !_nmTempCount! leq %_nmTempPrintB% (
__set /a _nmTempCount=!_nmTempCount!-%_nmDataSegLocA%+1
__if /i "%~3"=="noline" (echo;!_stTempOri:*:=!) else (echo;!_nmTempCount! !_stTempOri:*:=!))
__endlocal)
__goto eof
__:_WriteCode
__::syntax _st(%~1) :return _void
__call :_GetCodeSegLoc
__if not exist "%~1" goto eof
__if /i "%~1"=="%~f0" goto eof
__set _nmTempUpdateA=
__set _nmTempUpdateB=
__for /f "delims=:" %%i in ('%_stFindStrCmd% /x /c:"::code_segment" "%~1"') do set /a _nmTempUpdateA=%%i+1
__for /f "delims=:" %%i in ('%_stFindStrCmd% /x /c:"::code_ends" "%~1"') do set /a _nmTempUpdateB=%%i-1
__if "%_nmTempUpdateA%"=="" goto eof
__if "%_nmTempUpdateB%"=="" goto eof
__if %_nmTempUpdateA% geq %_nmTempUpdate% goto eof
__cd.>"%_stFileTemp%"
__set /a _nmTempCount=0
__for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~1"') do (set /a _nmTempCount+=1
__set "_stTempOri=%%i"
__setlocal enabledelayedexpansion
__if !_nmTempCount! lss %_nmTempUpdateA% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
__endlocal)
__set /a _nmTempCount=0
__for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~f0"') do (set /a _nmTempCount+=1
__set "_stTempOri=%%i"
__setlocal enabledelayedexpansion
__if !_nmTempCount! geq %_nmCodeSegLocA% if !_nmTempCount! leq %_nmCodeSegLocB% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
__endlocal)
__set /a _nmTempCount=0
__for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~1"') do (set /a _nmTempCount+=1
__set "_stTempOri=%%i"
__setlocal enabledelayedexpansion
__if !_nmTempCount! gtr %_nmTempUpdateB% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
__endlocal)
__type "%_stFileTemp%">"%~1"
__goto eof
__::code_ends
__
__::data_segment
__data 01
__data 02
__data 03
__::data_ends
__
__:eof
nekopack:delsubst:719:731
__@echo off
__if /i "%*"=="/nekolist" (echo DELSUBST 清除所有由 SUBST 命令指派的驱动器
__goto EOF)
__
__for /f "delims=:" %%i in ('subst') do (
__set "stDriveLetter=%%i"
__setlocal enabledelayedexpansion
__subst !stDriveLetter!: /d
__endlocal)
__set stDriveLetter=
__goto EOF
__
__:EOF
nekopack:dircomp:733:755
__@echo off
__if /i "%*"=="/nekolist" (echo DIRCOMP 目录结构比较工具
__goto EOF)
__if "%2"=="" goto NOSYNC
__set stTempFileA=%temp%\dc1.tmp
__set stTempFileB=%temp%\dc2.tmp
__
__cd.>"%stTempFileA%"
__cd.>"%stTempFileB%"
__tree "%1">>"%stTempFileA%"
__tree "%2">>"%stTempFileB%"
__fc "%stTempFileA%" "%stTempFileB%"
__goto EOF
__
__:NOSYNC
__echo 命令格式:%0 [dir1] [dir2]
__goto EOF
__
__:EOF
__if exist "%stTempFileA%" del "%stTempFileA%" /f
__if exist "%stTempFileB%" del "%stTempFileB%" /f
__set stTempFileA=
__set stTempFileB=
nekopack:edit:757:1199
__::1.0实现基本编辑功能(行编辑)
__::1.1实现文本分页式浏览
__::1.2实现基本编辑功能(段编辑)
__::1.3实现结构简洁化(代码优化)
__::1.4back指令可以跳转到具体某行
__::1.5函数化构建
__::1.6可处理空行
__::1.7可输出特殊字符
__::1.8结构优化;可输入特殊字符;检验:可编辑自身
__::1.9增加预设变量,解决嵌套bug
__
__@echo off
__if /i "%*"=="/nekolist" (echo EDIT 文本文件编辑器
__goto EOF)
__if /i "%1"=="/verify" goto VERIFY
__rem if exist "%systemroot%\system32\notepad.exe" (
__rem start %systemroot%\system32\notepad.exe %*
__rem goto EOF)
__:START
__call :END
__
__::临时文件
__set tempfile=%temp%\edit.tmp
__::控制入口
__set ctrcmd=#con
__::分页行数
__set pline=20
__::执行命令
__set cmdedit=off
__::保存备份文件
__set makebak=off
__::启动帮助
__set startmenu=off
__::自动返回
__set autoback=on
__
__::文件名设定
__if not "%1"=="" (set filename=%1
__goto EDITEXIST)
__echo 文本编辑 [版本 2.0.0120]
__echo Coded by neko, 2010. All rights reserved.
__if "%startmenu%"=="on" goto HELP
__goto CONTROL
__
__:CONTROL
__echo.
__:CONTRNL
__set ecmd=
__set editprompt=
__for /f %%i in ('cd') do set editprompt=%%i
__if "%cmdedit%"=="on" (set /p ecmd="edit %editprompt%>"
__) else (set /p ecmd="edit>")
__set editprompt=
__:CONTREL
__if exist "%tempfile%.1" for /f "delims=" %%i in ('findstr /n .* "%tempfile%.1"') do set "ecmd=%%i"
__if "%ecmd%"=="" goto CONTRNL
__if exist "%tempfile%.1" set "ecmd=%ecmd:*:=%"
__if exist "%tempfile%.1" del "%tempfile%.1" /f
__for /f "tokens=1" %%i in ("%ecmd%") do set ecmdf=%%i
__for /f "tokens=2" %%i in ("%ecmd%") do set ecmd1=%%i
__for /f "tokens=3" %%i in ("%ecmd%") do set ecmd2=%%i
__::调试命令
__if /i "%ecmdf%"=="init" (cls
__goto START)
__if /i "%ecmdf%"=="debug" (
__set
__goto CONTROL)
__if not "%cmdedit%"=="on" (
__if /i "%ecmdf%"=="e" goto EXPERR
__if /i "%ecmdf%"=="s" goto EXPERR
__if /i "%ecmdf%"=="se" goto EXPERR
__if /i "%ecmdf%"=="set" goto EXPERR
__call :EXPSHORT
__)
__::文件操作
__if /i "%ecmdf%"=="new" (
__set filename=%ecmd1%
__if "%ecmd1%"=="" set filename=新建文本文档.txt
__goto CREATENEW
__)
__if /i "%ecmdf%"=="open" (
__if "%ecmd1%"=="" (
__if "%filename%"=="" goto NOPEN
__echo 当前编辑的文件为 '%filename%'
__goto CONTROL)
__set filename=%ecmd1%
__goto EDITEXIST
__)
__if /i "%ecmdf%"=="save" (
__if "%filename%"=="" goto NOPEN
__if "%ecmd1%"=="" goto SAVEFILE
__set filename=%ecmd1%
__goto SAVEFILE)
__)
__if /i "%ecmdf%"=="back" (
__if "%filename%"=="" goto NOPEN
__set ecmd1=
__goto READFILE
__)
__if /i "%ecmdf%"=="help" goto HELP
__if /i "%ecmdf%"=="exit" goto END
__::编辑操作
__if /i "%ecmdf%"=="goto" (
__if "%filename%"=="" goto NOPEN
__if "%ecmd1%"=="" goto NOLINE
__goto READFILE
__)
__if /i "%ecmdf%"=="insert" goto INSERT
__if /i "%ecmdf%"=="delete" goto DELETE
__if /i "%ecmdf%"=="edline" goto LEDIT
__::程序设置
__if /i "%ecmdf%"=="cmdlines" (
__if /i "%ecmd1%"=="on" (set cmdedit=on) else (set cmdedit=off)
__goto CONTRNL
__)
__if /i "%ecmdf%"=="setlines" goto SETLINES
__if /i "%ecmdf%"=="setentry" (
__if "%ecmd1%"=="" goto CONTROL
__set ctrcmd=%ecmd1%
__goto CONTRNL
__)
__if /i "%ecmdf%"=="settings" (
__echo 临时文件 %tempfile%
__echo 控制入口 %ctrcmd%
__echo 分页行数 %pline%
__if "%cmdedit%"=="on" (echo 执行命令 已启用) else (echo 执行命令 已禁用)
__if "%makebak%"=="on" (echo 保存备份 已启用) else (echo 保存备份 已禁用)
__if "%startmenu%"=="on" (echo 启动帮助 已启用) else (echo 启动帮助 已禁用)
__if "%autoback%"=="on" (echo 自动返回 已启用) else (echo 自动返回 已禁用)
__goto CONTROL
__)
__::非法命令处理
__if "%ecmdf%"=="%ctrcmd%" (echo 当前已经处于控制状态。
__goto CONTROL)
__if "%cmdedit%"=="on" (call %ecmd%) else (
__echo '%ecmdf%' 不是有效指令,请键入 help 查询控制命令。)
__goto CONTROL
__
__:EXPSHORT
__set "ecmds=%ecmdf:~0,4%"
__if /i "%ecmds%"=="setl" set ecmdf=setlines
__if /i "%ecmds%"=="sete" set ecmdf=setentry
__if /i "%ecmds%"=="sett" set ecmdf=settings
__set "ecmds=%ecmdf:~0,2%"
__if /i "%ecmds%"=="ed" set ecmdf=edline
__if /i "%ecmds%"=="ex" set ecmdf=exit
__if /i "%ecmds%"=="sa" set ecmdf=save
__set "ecmds=%ecmdf:~0,1%"
__if /i "%ecmds%"=="n" set ecmdf=new
__if /i "%ecmds%"=="o" set ecmdf=open
__if /i "%ecmds%"=="b" set ecmdf=back
__if /i "%ecmds%"=="h" set ecmdf=help
__if /i "%ecmds%"=="g" set ecmdf=goto
__if /i "%ecmds%"=="i" set ecmdf=insert
__if /i "%ecmds%"=="d" set ecmdf=delete
__if /i "%ecmds%"=="c" set ecmdf=cmdlines
__goto EOF
__
__:EXPERR
__echo 二义性命令。
__goto CONTROL
__
__:NOPEN
__if exist "%tempfile%" del "%tempfile%" /f
__if exist "%tempfile%.1" del "%tempfile%.1" /f
__echo 未打开任何可编辑的文件。
__goto CONTROL
__
__:NOLINE
__echo 指定的行数不正确。
__goto CONTROL
__
__:SAVEFILE
__if "%filename%"=="" goto NOPEN
__if "%makebak%"=="on" (
__if exist "%filename%.bak" del "%filename%.bak" /f
__if exist "%filename%" move "%filename%" "%filename%.bak" >nul 2>nul
__if exist "%filename%.bak" (echo 备份文件 '%filename%.bak' 已保存。
__) else (echo 备份文件 '%filename%.bak' 保存失败。)
__) else (if exist "%filename%" del "%filename%" /f)
__copy "%tempfile%" "%filename%" >nul 2>nul
__if exist "%filename%" (echo 文件 '%filename%' 已保存。
__) else (echo 文件 '%filename%' 保存失败。)
__goto EDITEXIST
__
__:COUNTEXIST
__for /f %%i in ('findstr /n .* "%tempfile%"') do set /a tline+=1
__goto EOF
__
__:SETLINES
__if "%ecmd1%"=="" goto CONTROL
__if %ecmd1% LEQ 0 goto CONTROL
__set pline=%ecmd1%
__goto CONTRNL
__
__:HELP
__echo.
__echo 新建 new [文件名]
__echo 打开 open [文件名]
__echo 保存 save [文件名]
__echo 返回 back
__echo 帮助 help
__echo 退出 exit
__echo.
__echo 跳转 goto [行号]
__echo 插入 insert [行号]
__echo 编辑 edline [行号]
__echo 删除 delete [起始行号] [终止行号]
__echo.
__echo 命令行开关 cmdlines [on^|off]
__echo 分页行数设置 setlines [分页行数]
__echo 控制入口设置 setentry [控制入口字符串]
__echo 显示设置值 settings
__echo.
__echo 控制状态提示符为“edit^>”,编辑状态提示符为“行号: ”
__echo 在编辑状态中,输入“^%ctrcmd%”进入控制状态。
__goto CONTROL
__
__:INSERT
__set /a tline+=1
__if "%ecmd1%"=="" set ecmd1=%tline%
__if "%filename%"=="" goto NOPEN
__if not "%ecmd1%" GTR "0" goto NOLINE
__if not %ecmd1% LEQ %tline% (
__set /a tline-=1
__goto NOLINE)
__set /a tline-=1
__echo.
__cd.>"%tempfile%.1"
__set /a line=0
__for /f "delims=" %%i in ('findstr /n .* "%tempfile%"') do (set /a line+=1
__set "str=%%i"
__setlocal enabledelayedexpansion
__if !line! LSS %ecmd1% echo;!str:*:=!>>"%tempfile%.1"
__endlocal)
__set str=
__set /a line=%ecmd1%-1
__:INSPARA
__set /a line+=1
__set cLine=
__set /p cLine="%line%: "
__setlocal enabledelayedexpansion
__if not "!cLine!"=="%ctrcmd%" (
__echo;!cLine!>>"%tempfile%.1"
__endlocal
__goto INSPARA)
__endlocal
__set cLine=
__set /a line=0
__for /f "delims=" %%i in ('findstr /n .* "%tempfile%"') do (set /a line+=1
__set "str=%%i"
__setlocal enabledelayedexpansion
__if !line! GEQ %ecmd1% echo;!str:*:=!>>"%tempfile%.1"
__endlocal)
__set str=
__set line=
__if exist "%tempfile%" del "%tempfile%" /f
__move "%tempfile%.1" "%tempfile%" >nul 2>nul
__set ecmd1=
__if "%autoback%"=="on" goto READFILE
__call :COUNTEXIST
__goto CONTROL
__
__:DELETE
__if "%filename%"=="" goto NOPEN
__if "%ecmd1%"=="" goto NOLINE
__if "%ecmd2%"=="" goto NOLINE
__if %ecmd1% LEQ 0 goto NOLINE
__if %ecmd2% LSS %ecmd1% goto NOLINE
__if %ecmd1% GTR %tline% goto NOLINE
__if %ecmd2% GTR %tline% goto NOLINE
__cd.>"%tempfile%.1"
__set /a line=0
__for /f "delims=" %%i in ('findstr /n .* "%tempfile%"') do (set /a line+=1
__set "str=%%i"
__setlocal enabledelayedexpansion
__if !line! LSS %ecmd1% echo;!str:*:=!>>"%tempfile%.1"
__if !line! GTR %ecmd2% echo;!str:*:=!>>"%tempfile%.1"
__endlocal)
__set str=
__if exist "%tempfile%" del "%tempfile%" /f
__move "%tempfile%.1" "%tempfile%" >nul 2>nul
__set line=
__set ecmd1=
__set ecmd2=
__if "%autoback%"=="on" goto READFILE
__call :COUNTEXIST
__goto CONTROL
__
__:LEDIT
__if "%ecmd1%"=="" goto NOLINE
__if "%filename%"=="" goto NOPEN
__if %ecmd1% LEQ 0 goto NOLINE
__if %ecmd1% GTR %tline% goto NOLINE
__echo.
__set /a line=0
__for /f "delims=" %%i in ('findstr /n .* "%tempfile%"') do (set /a line+=1
__set "str=%%i"
__setlocal enabledelayedexpansion
__if !line! EQU %ecmd1% echo %ecmd1%: !str:*:=!
__endlocal)
__set str=
__set cLine=
__set /p cLine="%ecmd1%: "
__set /a line=0
__cd.>"%tempfile%.1"
__for /f "delims=" %%i in ('findstr /n .* "%tempfile%"') do (set /a line+=1
__set "str=%%i"
__setlocal enabledelayedexpansion
__if !line! LSS %ecmd1% echo;!str:*:=!>>"%tempfile%.1"
__if !line! EQU %ecmd1% echo;!cLine!>>"%tempfile%.1"
__if !line! GTR %ecmd1% echo;!str:*:=!>>"%tempfile%.1"
__endlocal)
__set line=
__set cLine=
__set str=
__if exist "%tempfile%" del "%tempfile%" /f
__move "%tempfile%.1" "%tempfile%" >nul 2>nul
__set ecmd1=
__if "%autoback%"=="on" goto READFILE
__call :COUNTEXIST
__goto CONTROL
__
__:CREATENEW
__echo.
__echo 创建文本 - %filename%
__set ecmd1=1
__set tline=0
__cd.>"%tempfile%"
__goto INSERT
__
__:EDITEXIST
__if not exist "%filename%" (
__echo 文件 '%filename%' 不存在。
__echo.
__setlocal enabledelayedexpansion
__set yn=
__set /p yn="是否打开编辑?[y/n] "
__if /i "!yn!"=="y" (endlocal
__set yn=
__goto CREATENEW) else (if "%1"=="%filename%" (endlocal
__set yn=
__goto END))
__endlocal
__set yn=
__set filename=
__goto CONTROL)
__cd.>"%tempfile%"
__for /f "delims=" %%i in ('findstr /n .* "%filename%"') do (
__set "str=%%i"
__setlocal enabledelayedexpansion
__echo;!str:*:=!>>"%tempfile%"
__endlocal)
__set str=
__set ecmd1=
__goto READFILE
__
__:READFILE
__echo.
__echo 编辑文本 - %filename%
__echo.
__set /a line=0
__set /a tline=0
__call :COUNTEXIST
__if "%tline%"=="0" (echo 文件为空或者无法正确识别。
__echo.
__setlocal enabledelayedexpansion
__set yn=
__set /p yn="是否打开编辑?[y/n] "
__if /i "!yn!"=="y" (endlocal
__set yn=
__set tline=0
__set ecmd1=1
__goto INSERT)
__endlocal
__set yn=
__goto CONTROL)
__if "%ecmd1%"=="" set ecmd1=1
__if %ecmd1% LEQ 0 goto NOLINE
__if %ecmd1% GTR %tline% goto NOLINE
__for /f "delims=" %%i in ('findstr /n .* "%tempfile%"') do (set /a line+=1
__set "str=%%i"
__setlocal enabledelayedexpansion
__if !line! GEQ %ecmd1% (
__echo !line!: !str:*:=!
__set /a turn=!line!-%ecmd1%+1
__set /a turn=!turn!%%pline%
__if !line! LSS %tline% if !turn! EQU 0 (
__set /a perc=!line!*100/%tline%
__echo [!line!/%tline%] !perc!%%
__set ecmd=
__set /p ecmd="按回车进入下一页 edit>"
__if not "!ecmd!"=="" (
__echo;!ecmd!>"%tempfile%.1"
__endlocal
__set line=
__set str=
__set ecmd1=
__goto CONTREL)
__echo.)
__)
__endlocal
__)
__set line=
__set str=
__set ecmd1=
__goto CONTROL
__
__:END
__if exist "%tempfile%" del "%tempfile%" /f
__if exist "%tempfile%.1" del "%tempfile%.1" /f
__set tempfile=
__set ctrcmd=
__set pline=
__set cmdedit=
__set makebak=
__set startmenu=
__set autoback=
__set filename=
__set tline=
__set ecmd=
__set ecmdf=
__set ecmds=
__goto EOF
__
__:VERIFY
__echo 文本编辑校验模式
__set inputfile=%temp%\edit.inscript
__set outputfile=%temp%\edit.output
__if exist "%outputfile%" del "%outputfile%" /f
__cd.>"%inputfile%"
__echo new>>"%inputfile%"
__type %~f0>>"%inputfile%"
__echo #con>>"%inputfile%"
__echo save %outputfile%>>"%inputfile%"
__echo exit>>"%inputfile%"
__call %~f0 < "%inputfile%"
__if exist "%inputfile%" del "%inputfile%" /f
__call read.cmd fc %~f0 "%outputfile%"
__if exist "%outputfile%" del "%outputfile%" /f
__goto EOF
__
__:EOF
nekopack:fcopy:1201:1216
__@echo off
__if /i "%1"=="/nekolist" (echo FCOPY 末尾强制标准化文本文件复制
__goto EOF)
__
__if "%2"=="" goto EOF
__if exist "%2" del /f "%2"
__cd.>"%2"
__for /f "delims=" %%i in ('findstr /n /i .* "%1"') do (
__set "stTemp=%%i"
__setlocal enabledelayedexpansion
__echo;!stTemp:*:=!>>"%2"
__endlocal)
__set stTemp=
__goto EOF
__
__:EOF
nekopack:flskv:1218:1321
__@echo off
__if /i "%*"=="/nekolist" (echo FLSKV 可移动磁盘防病毒扫描程序
__goto eof)
__set blExecutive=off
__title 可移动磁盘防病毒扫描程序
__echo 可移动磁盘防病毒扫描程序 [版本 1.1.0024]
__echo Coded by neko, 2010. All rights reserved.
__
__::统计数值
__set stFileCount=%temp%\countf.tmp
__set stFileKillList=%temp%\kilist.tmp
__cd.>"%stFileKillList%"
__::起始目录
__::for /f %%i in ('cd') do set stPath=%%~di
__set stPath=%cd%
__::清除列表
__echo bat>>"%stFileKillList%"
__echo com>>"%stFileKillList%"
__echo exe>>"%stFileKillList%"
__echo inf>>"%stFileKillList%"
__echo js>>"%stFileKillList%"
__echo jse>>"%stFileKillList%"
__echo lnk>>"%stFileKillList%"
__echo msc>>"%stFileKillList%"
__echo pif>>"%stFileKillList%"
__echo vbe>>"%stFileKillList%"
__echo vbs>>"%stFileKillList%"
__echo wsf>>"%stFileKillList%"
__echo wsh>>"%stFileKillList%"
__goto BEGIN
__
__:CLINE
__set /p=<nul
__goto eof
__
__::执行流程
__:BEGIN
__echo.
__echo 扫描目标 %stPath%,
__set /p=执行:枚举文件.<nul
__dir /a /b /s "%stPath%" 1>"%stFileCount%" 2>nul
__set nmTotal=0
__for /f "usebackq delims=" %%i in ("%stFileCount%") do (
__set /a nmTotal+=1
__setlocal enabledelayedexpansion
__set /a nmFactor=!nmTotal!%%100
__if !nmFactor! equ 0 set /p= .<nul
__set /a nmFactor=!nmTotal!%%600
__if !nmFactor! equ 0 (
__call :CLINE
__set /p=执行:枚举文件. <nul
__set /p=<nul
__)
__endlocal)
__call :CLINE
__echo 待处理项 %nmTotal% 个。
__echo.
__echo 执行:扫描文件. . .
__echo.
__set nmScanned=0
__for /f "usebackq delims=" %%i in ("%stFileCount%") do (
__if not "%%i"=="" (
__for /f "usebackq delims=" %%j in ("%stFileKillList%") do (
__if /i "%%~xi"==".%%j" (
__setlocal enabledelayedexpansion
__set "stTemp=%%~nxi "
__set stTemp=!stTemp:~0,40!
__echo !stTemp!
__endlocal
__if "%blExecutive%"=="on" (
__attrib "%%i" -s -h -r -a
__mkdir "\backup%%~pi">nul 2>nul
__move "%%i" "\backup%%~pi">nul 2>nul
__)
__))
__set /a nmScanned+=1
__setlocal enabledelayedexpansion
__set /a nmPercent=!nmScanned!*100/%nmTotal%
__set "stTemp=[!nmPercent!%%] %%~nxi "
__set stTemp=!stTemp:~0,40!
__set /p=!stTemp!<nul
__title 扫描进度 !nmPercent!%%
__call :CLINE
__if !nmPercent! equ 100 (endlocal
__goto END)
__endlocal
__)
__)
__goto END
__
__:END
__echo 扫描了 %nmScanned% 个文件/文件夹。
__title Coded by neko, 2010.
__set stPath=
__set nmTotal=
__set nmScanned=
__if exist "%stFileCount%" del "%stFileCount%" /f
__if exist "%stFileKillList%" del "%stFileKillList%" /f
__set stFileCount=
__set stFileKillList=
__set blExecutive=
__goto eof
__
__:eof
nekopack:glasscmd:1323:1336
__@echo off
__if /i "%*"=="/nekolist" (echo GLASSCMD 启用命令提示符磨砂玻璃效果
__goto EOF)
__
__start glasscmd.exe
__echo.
__echo Loading GlassCMD . . .
__echo.
__for /L %%i in (1 1 60) do set /p=^><nul&sleepx 1
__cls
__start pskill glasscmd.exe
__goto EOF
__
__:EOF
nekopack:ipv6:1338:1351
__@echo off
__if /i "%*"=="/nekolist" (echo IPV6 快速设置交大校内 IPv6 翻墙站点
__goto EOF)
__cd /d c:\windows\system32\drivers\etc
__if "%1"=="off" (netsh interface ipv6 isatap set state disabled
__ren hosts hosts.ipv6
__ren hosts.bak hosts
__) else (
__netsh interface ipv6 isatap set state enabled
__ren hosts hosts.bak
__ren hosts.ipv6 hosts)
__goto EOF
__
__:EOF
nekopack:j:1353:1416
__@echo off
__if /i "%*"=="/nekolist" (echo J 文件夹快速跳跃工具
__goto eof)
__if /i "%*"=="" (echo NEKO_GOTO_SCRIPTS
__set stOldPath=%cd%
__cd /d "%NekoScripts%"
__goto eof)
__if /i "%*"=="/b" (echo NEKO_GO_BACK
__if "%stOldPath%"=="" goto eof
__cd /d "%stOldPath%"
__goto eof)
__if /i "%*"=="/s" goto NEKO_SET_PATH_TEMP
__:::::::::::::::::::::::::::::::::::::
__if /i "%*"=="-t" (echo NEKO_GOTO_LMMS_TOOLKIT
__cd /d "D:\Projects\lmms\toolkit"
__goto eof)
__if /i "%*"=="-e" (
__if not exist e: (
__echo NEKO_OPEN_DRIVE_E
__echo select disk ^0>"%temp%\~j.tmp"
__echo select partition ^3>>"%temp%\~j.tmp"
__echo assign letter=e>>"%temp%\~j.tmp"
__echo exit>>"%temp%\~j.tmp"
__diskpart <"%temp%\~j.tmp"
__if exist "%temp%\~j.tmp" del "%temp%\~j.tmp" /f
__cd /d E:\
__) else (
__echo NEKO_CLOSE_DRIVE_E
__echo select disk ^0>"%temp%\~j.tmp"
__echo select partition ^3>>"%temp%\~j.tmp"
__echo remove>>"%temp%\~j.tmp"
__echo exit>>"%temp%\~j.tmp"
__diskpart < "%temp%\~j.tmp"
__if exist "%temp%\~j.tmp" del "%temp%\~j.tmp" /f
__cd /d "%NekoScripts%"
__)
__goto eof)
__if /i "%*"=="-m" goto NEKOGOTOMASM
__:::::::::::::::::::::::::::::::::::::
__set /a nmTempCount=0
__for /f "delims=" %%i in ('dir /a:d /b %**') do (set /a nmTempCount+=1
__set "stNewPath=%%i")
__if %nmTempCount% EQU 1 (echo NEKO_QUICK_JUMPER
__cd "%stNewPath%")
__if %nmTempCount% GTR 1 dir /a:d /b %**
__set nmTempCount=
__goto eof
__:::::::::::::::::::::::::::::::::::::
__:NEKOSETPATHTEMP
__echo NEKO_SET_PATH_TEMP
__set "NekoScripts=%cd%"
__set "path=%path%;%NekoScripts%"
__goto eof
__:NEKOGOTOMASM
__if "%nekomasmset%"=="true" goto NEKOGOTOMASMGO
__set "nekomasmset=true"
__set "nekomasm=d:\process\masm"
__set "include=%nekomasm%\masm32\include"
__set "lib=%nekomasm%\masm32\lib"
__set "path=%path%;%nekomasm%\masm32\bin"
__:NEKOGOTOMASMGO
__cd /d "%nekomasm%\code"
__goto eof
__:eof
nekopack:ll:1418:1430
__@echo off
__if /i "%*"=="/nekolist" (echo LL 列表查看目录和文件
__goto EOF)
__set stFileTemp=%temp%\fx.tmp
__echo;%1>"%stFileTemp%"
__for /f "delims=" %%i in ('dir /a:d /b %1') do echo %%~ai %%~ti %%~zi %%i>>"%stFileTemp%"
__echo.>>"%stFileTemp%"
__for /f "delims=" %%i in ('dir /a:-d /b %1') do echo %%~ai %%~ti %%~zi %%i>>"%stFileTemp%"
__if /i "%1"=="/p" (call read %stFileTemp%) else (type %stFileTemp%)
__if exist "%stFileTemp%" del "%stFileTemp%" /f
__set stFileTemp=
__goto EOF
__:EOF
nekopack:m4:1432:1438
__@echo off
__if /i "%*"=="/nekolist" (echo M4 启动 4 个 MPICH2 并行进程
__goto EOF)
__
__mpiexec -np 4 %*
__
__:EOF
nekopack:mycmd:1440:1459
__@echo off
__if /i "%*"=="/nekolist" (echo MYCMD 命令提示符
__goto EOF)
__if "%*"=="" (echo 命令提示符
__echo Coded by Neko, 2011. All rights reserved.
__echo.
__set "stMyCmdLine=") else (set "stMyCmdLine=%*")
__
__:MYCONTROL
__for /f %%i in ('cd') do set stMyPrompt=%%i
__if "%stMyCmdLine%"=="" set /p stMyCmdLine="NEKO %stMyPrompt%>"
__if "%stMyCmdLine%"=="exit" goto EOF
__call %stMyCmdLine%
__if not "%stMyCmdLine%"=="" echo.
__set stMyCmdLine=
__goto MYCONTROL
__
__:EOF
__set stMyPrompt=
__set stMyCmdLine=
nekopack:n:1461:1481
__::记事本调用程序
__::Coded by neko, 2010. All rights reserved.
__@echo off
__if /i "%*"=="/nekolist" (echo N 快速打开和编辑文本文件
__goto EOF)
__if "%*"=="" (start notepad.exe
__goto EOF)
__set /a nmFileCount=0
__for /f "delims=" %%i in ('dir /a:-d /b %1*') do (set /a nmFileCount+=1
__set "stFileName=%%i")
__if %nmFileCount% equ 1 (start notepad.exe "%stFileName%"
__goto EOF)
__if "%2"=="/f" (copy nul "%1">nul
__start notepad.exe "%1"
__goto EOF)
__if %nmFileCount% gtr 1 dir /a:-d /b "%1*"
__goto EOF
__
__:EOF
__set nmFileCount=
__set stFileName=
nekopack:o:1483:1492
__@echo off
__if /i "%*"=="/nekolist" (echo O 快速打开文件夹
__goto EOF)
__
__if "%1"=="" (call explorer .
__) else (
__call explorer %1)
__goto EOF
__
__:EOF
nekopack:q:1494:1494
__@x.cmd %*
nekopack:read:1496:1590
__@echo off
__if /i "%*"=="/nekolist" (echo READ 文本分页显示工具
__goto EOF)
__if "%1"=="" goto HELP
__if "%1"=="/?" goto HELP
__::每次显示的行数
__set /a pline=23
__::临时文件
__set tempfile=%temp%\read.tmp
__::入口处理
__set ecmd1=1
__
__if not exist "%1" goto RCMDL
__set filename=%1
__goto RFILE
__
__:CONTREL
__if exist "%tempfile%.1" for /f "delims=" %%i in ('findstr /n .* "%tempfile%.1"') do set "ecmd=%%i"
__set ecmd=%ecmd:*:=%
__if exist "%tempfile%.1" del "%tempfile%.1" /f
__set /a ecmd1=%ecmd%
__set ecmd=
__if %ecmd1% LEQ 0 goto NOLINE
__if %ecmd1% GTR %tline% goto NOLINE
__goto RFILE
__
__:NOLINE
__rem echo.
__rem echo 行号不正确。
__goto EOF
__
__:RCMDL
__%*>"%tempfile%"
__set filename=%tempfile%
__if not exist "%filename%" goto EOF
__goto RFILE
__
__:RFILE
__echo.
__echo 分页显示 - %*
__echo Coded by neko, 2010. All rights reserved.
__echo.
__set tline=0
__for /f "delims=" %%i in ('findstr /n .* "%filename%"') do set /a tline+=1
__set line=0
__for /f "delims=" %%i in ('findstr /n .* "%filename%"') do (set /a line+=1
__set "str=%%i"
__setlocal enabledelayedexpansion
__if !line! GEQ %ecmd1% (
__set /a turn=!line!-%ecmd1%+1
__set /a turn=!turn!%%pline%
__echo !line!: !str:*:=!
__::if !line! EQU %tline% pause
__if !line! LSS %tline% if !turn! EQU 0 (
__set /a perc=!line!*100/%tline%
__echo [!line!/%tline%] !perc!%%
__set ecmd=
__set /p ecmd="按回车进入下一页 >"
__if not "!ecmd!"=="" (
__if exist "%tempfile%.1" del "%tempfile%.1" /f
__echo;!ecmd!>>"%tempfile%.1"
__set perc=
__set line=
__set str=
__endlocal
__goto CONTREL)
__echo.)
__)
__endlocal
__)
__set str=
__set line=
__set ecmd1=
__goto EOF
__
__:HELP
__echo.
__echo 显示文件内容
__echo 示例:read abc.txt
__echo.
__echo 显示命令输出
__echo 示例:read help
__goto EOF
__
__:EOF
__if exist "%tempfile%" del /f "%tempfile%"
__if exist "%tempfile%.1" del /f "%tempfile%.1"
__set tempfile=
__set filename=
__set pline=
__set line=
__set tline=
__set ecmd=
__set ecmd1=
__set str=
nekopack:scdedit:1592:1909
__@echo off
__if /i "%1"=="/nekolist" (echo SCDEDIT 隐藏目录数据存储编辑器
__goto eof)
__
__::main_segment
__set rGUID={645FF040-5081-101B-9F08-00AA002F954E}
__set rFLAG=0
__call :_SetInit
__if "%1"=="" goto LIST
__if /i "%1"=="/?" goto HELP
__if /i "%1"=="-help" goto HELP
__if /i "%1"=="/help" goto HELP
__if /i "%1"=="-add" goto ADD
__if /i "%1"=="/add" goto ADD
__if /i "%1"=="-remove" goto REMOVE
__if /i "%1"=="/remove" goto REMOVE
__if /i "%1"=="-adcvt" (set rFLAG=1
__goto ADD)
__if /i "%1"=="/adcvt" (set rFLAG=1
__goto ADD)
__if /i "%1"=="-rmcvt" (set rFLAG=1
__goto REMOVE)
__if /i "%1"=="/rmcvt" (set rFLAG=1
__goto REMOVE)
__if /i "%1"=="-list" goto LIST
__if /i "%1"=="/list" goto LIST
__if /i "%1"=="-open" goto OPEN
__if /i "%1"=="/open" goto OPEN
__goto ERRSYNC
__
__:LIST
__echo 隐藏目录列表
__echo.
__call :_GetDataCount
__if %_nmDataCount% equ 0 goto NORECORD
__call :_PrintData ALL
__goto END
__
__:HELP
__echo.
__echo SCDEDIT - 启动隐藏目录数据存储编辑器
__echo.
__echo 命令行参数列表
__echo -help 显示命令帮助,参数0
__echo -list 显示目录数据,参数0
__echo -add 添加目录数据,参数1[路径]
__echo -remove 移除目录数据,参数1[数值]
__echo -adcvt 添加目录数据并转换目录,参数1[路径]
__echo -rmcvt 移除目录数据并还原目录,参数1[数值]
__echo -open 打开隐藏目录,参数1[数值],参数2[盘符]
__goto END
__
__:ADD
__if "%2"=="" goto ERRSYNC
__if not "%3"=="" goto ERRSYNC
__call :_GetDataCount
__call :_FindData "%2"
__if %_nmFindData% neq 0 (echo 指定的项在数据库中已存在。
__goto END)
__if %rFLAG% equ 0 (if not exist "%2.%rGUID%" (echo 目标文件夹 %2.%rGUID% 不存在。
__goto END) else (call :_InsertData %_nmDataCount% "%2"))
__if %rFLAG% equ 1 (if not exist "%2" (echo 目标文件夹 %2 不存在。
__goto END) else (call :_InsertData %_nmDataCount% "%2"
__attrib "%2" -s -h -r -a >nul 2>nul
__move "%2" "%2.%rGUID%" >nul 2>nul
__attrib "%2.%rGUID%" +s +h +r -a))
__echo 操作成功完成。
__goto END
__
__:REMOVE
__if "%2"=="" goto ERRSYNC
__if not "%3"=="" goto ERRSYNC
__call :_GetDataCount
__if %2 lss 1 goto END
__if %2 gtr %_nmDataCount% goto END
__call :_GetData %2
__if %rFLAG% equ 0 (call :_RemoveData %2 %2)
__if %rFLAG% equ 1 (call :_RemoveData %2 %2
__if not exist "%_stData%.%rGUID%" (echo 目标文件夹 %_stData%.%rGUID% 不存在。
__) else (attrib "%_stData%.%rGUID%" -s -h -r -a >nul 2>nul
__move "%_stData%.%rGUID%" "%_stData%" >nul 2>nul))
__echo 操作成功完成。
__goto END
__
__:OPEN
__if "%3"=="" goto ERRSYNC
__if not "%4"=="" goto ERRSYNC
__call :_GetDataCount
__if %2 lss 1 goto END
__if %2 gtr %INFO_DATA_COUNT% goto END
__call :_GetData %2
__if not exist "%_stData%.%rGUID%" (echo 目标文件夹 %_stData%.%rGUID% 不存在。
__) else (subst %3 "%_stData%.%rGUID%" >nul 2>nul
__explorer %3
__echo 已打开指定目录,若要关闭,
__pause
__subst %3 /d)
__echo 操作成功完成。
__goto END
__
__:ERRSYNC
__echo 指定的命令行无效。
__echo 运行 "scdedit /?" 获得命令行帮助。
__goto END
__
__:NORECORD
__echo 没有已记录的隐藏目录。
__goto END
__
__:END
__set rGUID=
__set rFLAG=
__goto _SetClear
__::main_ends
__::code_segment
__goto eof
__:_PrintHelp
__::syntax _void :return _return(_GetCodeSegLoc)
__call :_GetCodeSegLoc
__set /a _nmTempCount=0
__for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~f0"') do (set /a _nmTempCount+=1
__set "_stTempOri=%%i"
__setlocal enabledelayedexpansion
__set "_stTempOri=!_stTempOri:*:=!"
__if !_nmTempCount! geq %_nmCodeSegLocA% if !_nmTempCount! leq %_nmCodeSegLocB% (
__set "_stTempIns=!_stTempOri:~0,1!"
__set "_stTempOri=!_stTempOri:~1!"
__if "!_stTempIns!"==":" echo !_stTempOri!
__)
__endlocal)
__goto eof
__:_SetInit
__::syntax _void :return _stNekoVer, _stFileTemp, _stFindStrCmd
__set _stNekoVer=20110226
__set _stFileTemp=%temp%\%~n0.tmp
__set _stFindStrCmd=findstr /i /n
__goto eof
__:_SetClear
__::syntax _void :return _void
__set _nmTempDataLoc=
__set _nmTempCount=
__set _nmTempInsStart=
__set _nmTempInsLoc=
__set _stTempIns=
__set _stTempOri=
__set _nmTempRemoveA=
__set _nmTempRemoveB=
__set _nmTempPrintA=
__set _nmTempPrintB=
__set _nmTempUpdateA=
__set _nmTempUpdateB=
__if not "%_stFileTemp%"=="" if exist "%_stFileTemp%" del /f "%_stFileTemp%"
__set _stNekoVer=
__set _stFileTemp=
__set _stFindStrCmd=
__set _nmCodeSegLocA=
__set _nmCodeSegLocB=
__set _nmDataSegLocA=
__set _nmDataSegLocB=
__set _nmDataCount=
__set _nmFindData=
__set _stData=
__goto eof
__:_GetCodeSegLoc
__::syntax _void :return _nmAbs(_nmCodeSegLocA), _nmAbs(_nmCodeSegLocB)
__for /f "delims=:" %%i in ('%_stFindStrCmd% /x /c:"::code_segment" "%~f0"') do set /a _nmCodeSegLocA=%%i+1
__for /f "delims=:" %%i in ('%_stFindStrCmd% /x /c:"::code_ends" "%~f0"') do set /a _nmCodeSegLocB=%%i-1
__goto eof
__:_GetDataSegLoc
__::syntax _void :return _nmAbs(_nmDataSegLocA), _nmAbs(_nmDataSegLocB)
__for /f "delims=:" %%i in ('%_stFindStrCmd% /x /c:"::data_segment" "%~f0"') do set /a _nmDataSegLocA=%%i+1
__for /f "delims=:" %%i in ('%_stFindStrCmd% /x /c:"::data_ends" "%~f0"') do set /a _nmDataSegLocB=%%i-1
__goto eof
__:_GetDataCount
__::syntax _void :return _return(_GetDataSegLoc), _nmRel(_nmDataCount)
__call :_GetDataSegLoc
__set /a _nmDataCount=1+%_nmDataSegLocB%-%_nmDataSegLocA%
__goto eof
__:_FindData
__::syntax _st(%~1) :return _nmAbs(_nmFindData)
__set /a _nmFindData=0
__for /f "delims=:" %%i in ('%_stFindStrCmd% /x /c:"%~1" "%~f0"') do set /a _nmFindData=%%i
__goto eof
__:_GetData
__::syntax _nmRel(%~1) :return _return(_GetDataCount), _stData
__call :_GetDataCount
__if %~1 lss 1 goto eof
__if %~1 gtr %_nmDataCount% goto eof
__set /a _nmTempDataLoc=%~1+%_nmDataSegLocA%-1
__set /a _nmTempCount=0
__for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~f0"') do (set /a _nmTempCount+=1
__set "_stTempOri=%%i"
__setlocal enabledelayedexpansion
__if !_nmTempCount! equ %_nmTempDataLoc% echo;!_stTempOri:*:=!>"%_stFileTemp%"
__endlocal)
__for /f "usebackq delims=" %%i in ("%_stFileTemp%") do set "_stData=%%i"
__goto eof
__:_InsertData
__::syntax _nmRel(%~1), _st(%~2) :return _return(_GetDataSegLoc)
__call :_GetDataSegLoc
__set /a _nmTempInsStart=%_nmDataSegLocA%-1
__set /a _nmTempInsLoc=%~1+%_nmDataSegLocA%-1
__if %_nmTempInsLoc% lss %_nmTempInsStart% goto eof
__if %_nmTempInsLoc% gtr %_nmDataSegLocB% goto eof
__set "_stTempIns=%~1:%~2"
__cd.>"%_stFileTemp%"
__set /a _nmTempCount=0
__for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~f0"') do (set /a _nmTempCount+=1
__set "_stTempOri=%%i"
__setlocal enabledelayedexpansion
__if !_nmTempCount! leq %_nmTempInsLoc% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
__if !_nmTempCount! equ %_nmTempInsLoc% echo;!_stTempIns:*:=!>>"%_stFileTemp%"
__if !_nmTempCount! gtr %_nmTempInsLoc% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
__endlocal)
__type "%_stFileTemp%">"%~f0"
__goto eof
__:_InsertFile
__::syntax _nmRel(%~1), _st(%~2) :return _return(_GetDataSegLoc)
__call :_GetDataSegLoc
__set /a _nmTempInsStart=%_nmDataSegLocA%-1
__set /a _nmTempInsLoc=%~1+%_nmDataSegLocA%-1
__if %_nmTempInsLoc% lss %_nmTempInsStart% goto eof
__if %_nmTempInsLoc% gtr %_nmDataSegLocB% goto eof
__if not exist "%~2" goto eof
__set "_stTempIns=%~2"
__cd.>"%_stFileTemp%"
__set /a _nmTempCount=0
__for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~f0"') do (set /a _nmTempCount+=1
__set "_stTempOri=%%i"
__setlocal enabledelayedexpansion
__if !_nmTempCount! leq %_nmTempInsLoc% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
__if !_nmTempCount! equ %_nmTempInsLoc% type "%_stTempIns%">>"%_stFileTemp%"
__if !_nmTempCount! gtr %_nmTempInsLoc% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
__endlocal)
__type "%_stFileTemp%">"%~f0"
__goto eof
__:_RemoveData
__::syntax _st(%~1), _nmRel(%~1), _nmRel(%~2) :return _return(_GetDataSegLoc)
__call :_GetDataSegLoc
__if /i "%~1"=="all" (set /a _nmTempRemoveA=%_nmDataSegLocA%
__set /a _nmTempRemoveB=%_nmDataSegLocB%
__) else (set /a _nmTempRemoveA=%~1+%_nmDataSegLocA%-1
__set /a _nmTempRemoveB=%~2+%_nmDataSegLocA%-1)
__if %_nmTempRemoveA% lss %_nmDataSegLocA% goto eof
__if %_nmTempRemoveA% gtr %_nmDataSegLocB% goto eof
__if %_nmTempRemoveB% lss %_nmDataSegLocA% goto eof
__if %_nmTempRemoveB% gtr %_nmDataSegLocB% goto eof
__if %_nmTempRemoveA% gtr %_nmTempRemoveB% goto eof
__cd.>"%_stFileTemp%"
__set /a _nmTempCount=0
__for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~f0"') do (set /a _nmTempCount+=1
__set "_stTempOri=%%i"
__setlocal enabledelayedexpansion
__if !_nmTempCount! lss %_nmTempRemoveA% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
__if !_nmTempCount! gtr %_nmTempRemoveB% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
__endlocal)
__type "%_stFileTemp%">"%~f0"
__goto eof
__:_PrintData
__::syntax _st(%~1), _nmRel(%~1), _st(%~2), _nmRel(%~2), _st(%~3) :return _return(_GetDataSegLoc)
__call :_GetDataSegLoc
__if /i "%~1"=="all" (set /a _nmTempPrintA=%_nmDataSegLocA%
__set /a _nmTempPrintB=%_nmDataSegLocB%
__) else (set /a _nmTempPrintA=%~1+%_nmDataSegLocA%-1
__set /a _nmTempPrintB=%~2+%_nmDataSegLocA%-1)
__if %_nmTempPrintA% lss %_nmDataSegLocA% goto eof
__if %_nmTempPrintA% gtr %_nmDataSegLocB% goto eof
__if %_nmTempPrintB% lss %_nmDataSegLocA% goto eof
__if %_nmTempPrintB% gtr %_nmDataSegLocB% goto eof
__if %_nmTempPrintA% gtr %_nmTempPrintB% goto eof
__set /a _nmTempCount=0
__for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~f0"') do (set /a _nmTempCount+=1
__set "_stTempOri=%%i"
__setlocal enabledelayedexpansion
__if !_nmTempCount! geq %_nmTempPrintA% if !_nmTempCount! leq %_nmTempPrintB% (
__set /a _nmTempCount=!_nmTempCount!-%_nmDataSegLocA%+1
__if /i "%~3"=="noline" (echo;!_stTempOri:*:=!) else (echo;!_nmTempCount! !_stTempOri:*:=!))
__endlocal)
__goto eof
__:_WriteCode
__::syntax _st(%~1) :return _void
__call :_GetCodeSegLoc
__if not exist "%~1" goto eof
__if /i "%~1"=="%~f0" goto eof
__set _nmTempUpdateA=
__set _nmTempUpdateB=
__for /f "delims=:" %%i in ('%_stFindStrCmd% /x /c:"::code_segment" "%~1"') do set /a _nmTempUpdateA=%%i+1
__for /f "delims=:" %%i in ('%_stFindStrCmd% /x /c:"::code_ends" "%~1"') do set /a _nmTempUpdateB=%%i-1
__if "%_nmTempUpdateA%"=="" goto eof
__if "%_nmTempUpdateB%"=="" goto eof
__if %_nmTempUpdateA% geq %_nmTempUpdate% goto eof
__cd.>"%_stFileTemp%"
__set /a _nmTempCount=0
__for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~1"') do (set /a _nmTempCount+=1
__set "_stTempOri=%%i"
__setlocal enabledelayedexpansion
__if !_nmTempCount! lss %_nmTempUpdateA% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
__endlocal)
__set /a _nmTempCount=0
__for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~f0"') do (set /a _nmTempCount+=1
__set "_stTempOri=%%i"
__setlocal enabledelayedexpansion
__if !_nmTempCount! geq %_nmCodeSegLocA% if !_nmTempCount! leq %_nmCodeSegLocB% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
__endlocal)
__set /a _nmTempCount=0
__for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~1"') do (set /a _nmTempCount+=1
__set "_stTempOri=%%i"
__setlocal enabledelayedexpansion
__if !_nmTempCount! gtr %_nmTempUpdateB% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
__endlocal)
__type "%_stFileTemp%">"%~1"
__goto eof
__::code_ends
__
__::data_segment
__::data_ends
__
__:eof
nekopack:setntshell:1911:1932
__@echo off
__::explorer.exe or cmd.exe
__if /i "%*"=="/nekolist" (echo SETNTSHELL 更改 Windows NT Shell
__goto EOF)
__set "stRegTemp=%temp%\snstemp.reg"
__echo 更改 Windows NT Shell
__echo Coded by neko, 2010. All rights reserved.
__echo Windows Registry Editor Version 5.00 >"%stRegTemp%"
__echo. >>"%stRegTemp%"
__echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon] >>"%stRegTemp%"
__echo "Shell"="%1" >>"%stRegTemp%"
__echo.
__type "%stRegTemp%"
__echo.
__set /p blYesNo="验证信息是否正确?(y/n) "
__if /i "%blYesNo%"=="y" reg import "%stRegTemp%"
__if exist "%stRegTemp%" del "%stRegTemp%" /f
__set stRegTemp=
__set blYesNo=
__goto EOF
__
__:EOF
nekopack:show_percent:1934:1952
__@echo off
__if /i "%*"=="/nekolist" (echo SHOW_PERCENT 进度条演示程序
__goto EOF)
__echo 进度条演示程序
__echo Coded by neko, 2010. All rights reserved.
__echo.
__set /p=[<nul
__::for /l %%i in (1 1 50) do set /p=.<nul
__set /p=- <nul
__set /p=]<nul
__for /l %%i in (1 1 51) do set /p=<nul
__for /l %%i in (1 1 50) do (
__set /p=" =="<nul
__sleepx 50
__)
__echo.
__goto EOF
__
__:EOF
nekopack:show_title:1954:1979
__@echo off
__if /i "%*"=="/nekolist" (echo SHOW_TITLE 标题动画演示
__goto EOF)
__setlocal enabledelayedexpansion %title {s11ss 2007-12-12}%
__call :m "www.cn-dos.net" " " 4 50
__title Press any key to exit...&pause>nul&title %comspec%&exit/b
__:m
__set s=%~1
__set c=%~2
__set n=%3
__set "d=for /l %%z in (1,1,%4) do cd."
__set t=%s%
__:c
__set t=%t:~1%&set/a l+=1
__if not "%t%" equ "" goto :c
__for /l %%a in (1,1,%l%) do %d%&title !s:~0,%%a!
__for /l %%a in (%l%,-1,1) do %d%&title !s:~0,%%a!
__set/a t=%l%-1
__for /l %%a in (1,1,%n%) do set "space=!space!%c%"&for /l %%b in (1,1,%t%) do set s%%b%%a=!s:~0,%%b!!space!!s:~%%b,1!
__for /l %%a in (1,1,%t%) do for /l %%b in (%n%,-1,1) do %d%&title !s%%a%%b!
__title !s!&%d%
__for /l %%a in (%t%,-1,1) do for /l %%b in (1,1,%n%) do %d%&title !s%%a%%b!
__
__goto EOF
__
__:EOF
nekopack:show_winxp:1981:2004
__@echo off
__if /i "%*"=="/nekolist" (echo SHOW_WINXP Windows XP 启动进度条演示
__goto EOF)
__::批处理进度条演示程序
__::Coded by neko, 2010. All rigths reserved.
__
__if "%1"=="" call :CLEAR
__echo.
__for /L %%i in (0,1,77) do set /p=" =="<nul
__for /L %%i in (0,1,78) do set /p=<nul
__for /L %%i in (0,1,78) do (
__sleepx 50
__set /p=^><nul)
__echo.
__cls
__goto EOF
__
__:CLEAR
__cls
__for /l %%i in (1 1 100) do echo.
__echo Windows 正在启动
__goto EOF
__
__:EOF
nekopack:splitext:2006:2072
__@echo off
__if /i "%*"=="/nekolist" (echo SPLITEXT 文本文件分割工具
__goto EOF)
__echo 文本分割 [版本 1.0.0008]
__echo Coded by neko, 2010. All rights reserved.
__echo.
__if "%1"=="" goto NOFILE
__if not exist "%1" goto NOFILE
__set stFileTemp=%temp%\splitext.tmp
__set nmTotalnmCurLine=0
__echo 正在扫描文本
__set /p=[^> ]<nul
__set /p=<nul
__for /f "usebackq delims=" %%i in ("%1") do (set /a nmTotalnmCurLine+=1
__setlocal enabledelayedexpansion
__set /a tt=!nmTotalnmCurLine!%%100
__if !tt! EQU 0 set /p= ^><nul
__set /a tt=!nmTotalnmCurLine!%%1000
__if !tt! EQU 0 (
__set /p=<nul
__set /p=[^> ]<nul
__set /p=<nul
__)
__endlocal)
__set /p=<nul
__echo '%1' 文本总行数 %nmTotalnmCurLine%
__echo.
__if "%2"=="" (set /p nmTotalPart="输出文件数:") else (set "nmTotalPart=%2"
__echo 输出文件数:%2)
__if %nmTotalPart% LEQ 0 goto PERROR
__echo.
__set /a pnmCurLine=%nmTotalnmCurLine%/%nmTotalPart%
__set nmCurLine=0
__echo ^0>"%stFileTemp%"
__set stTemp=
__for /f "usebackq delims=" %%i in ("%1") do (set /a nmCurLine+=1
__set "stTemp=%%i"
__setlocal enabledelayedexpansion
__set /a nmPercent=!nmCurLine!*100/%nmTotalnmCurLine%
__set /p=[!nmPercent!%%]<nul
__for /f "usebackq" %%j in ("%stFileTemp%") do set nmCurPart=%%j
__echo;!stTemp!>>%~n1_!nmCurPart!.txt
__set /a blTurn=!nmCurLine!%%!pnmCurLine!
__if !nmCurLine! LSS %nmTotalnmCurLine% if !blTurn! EQU 0 (
__set /a nmCurPart+=1
__echo !nmCurPart!>"%stFileTemp%"
__cd.>%~n1_!nmCurPart!.txt
__)
__endlocal
__)
__echo 执行完成。
__set nmCurLine=
__set nmCurPart=
__set stTemp=
__set nmTotalnmCurLine=
__if exist "%stFileTemp%" del "%stFileTemp%" /f
__goto EOF
__
__:PERROR
__echo 输出文件数 %nmTotalPart% 错误。
__goto EOF
__
__:NOFILE
__echo 文本 '%1' 不存在。
__goto EOF
__
__:EOF
nekopack:srchstr:2074:2097
__@echo off
__if /i "%*"=="/nekolist" (echo SRCHSTR 字符串搜索工具
__goto EOF)
__echo 查找字符串
__echo Coded by neko, 2010. All rights reserved.
__echo.
__
__if "%1"=="" (
__echo 在当前目录的所有文件中搜索字符串。
__echo 所带参数即为待查找字符串。
__goto EOF)
__
__for /f %%i in ('dir /a:-d /b') do (
__setlocal enabledelayedexpansion
__>nul findstr /c:"%*" %%i
__if !errorlevel! EQU 0 (
__echo 包含字符串的文件:"%%i"
__)
__endlocal
__)
__echo 查找结束。
__goto EOF
__
__:EOF
nekopack:vdir:2099:2115
__@echo off
__if /i "%*"=="/nekolist" (echo VDIR 文件夹判断程序
__goto EOF)
__for /f "delims=" %%i in ('cd') do set stCurPath=%%i
__if "%1"=="" goto NOSYNX
__if not exist "%1" (echo '%1' 不存在
__goto EOF)
__cd "%1">nul 2>nul
__if %errorlevel% EQU 0 (echo %1 是文件夹&cd /d "%stCurPath%") else (echo %1 是文件)
__goto EOF
__
__:NOSYNX
__echo 命令格式:%0 [path]
__goto EOF
__
__:EOF
__set stCurPath=
nekopack:x:2117:2123
__@echo off
__if /i "%*"=="/nekolist" (echo X 执行命令并退出命令行
__goto EOF)
__call %*
__exit
__goto EOF
__:EOF
::data_ends
:eof
if /i "%1"=="/nekolist" (echo NEKOPACK 查看,打包和安装 NekoScripts 命令集
goto eof)
if "%NekoScripts%"=="" (echo 找不到 NekoScripts 命令集,无法执行打包。
goto eof)
::main_segment
set stFileTemp=%temp%\%~n0.tmpx
call :_SetInit
if /i "%1"=="" goto LIST
if /i "%1"=="/?" goto HELP
set "stSelect=%1"
set "stSelect=%stSelect:~1%"
if /i "%stSelect%"=="help" goto HELP
if /i "%stSelect%"=="list" goto LIST
if /i "%stSelect%"=="pack" goto PACK
if /i "%stSelect%"=="clear" goto CLEAR
if /i "%stSelect%"=="extract" goto EXTRACT
goto LIST
:LIST
for /f "usebackq tokens=1,2,3,4 delims=:" %%i in ("%~f0") do (
if "%%i"=="nekopack" if "%%j"=="menu" (
set nmListA=%%k
set nmListB=%%l))
call :_PrintData %nmListA% %nmListB% noline
goto END
:HELP
echo Neko 命令集打包载体应用程序
echo.
echo -help 显示此命令,参数0
echo -list 显示已打包的命令,参数0
echo -pack 打包 NekoScripts 中命令文件,参数0
echo -clear 清除所有已打包的命令,参数0
echo -extract 释放已打包的命令,参数1[文件名或-all],参数2[路径]
goto END
:PACK
call :_RemoveData all
echo;NekoScripts 包中可用命令列表 更新于 %date%>"%stFileTemp%"
for /f %%i in ('dir "%NekoScripts%\*.cmd" /a:-d /b') do call %NekoScripts%\%%i /nekolist>>"%stFileTemp%"
call :CNTLINES "%stFileTemp%"
set /a nmLineCount+=1
call :_InsertData 0 "nekopack:menu:2:%nmLineCount%"
call :_InsertFile 1 "%stFileTemp%"
for /f %%i in ('dir "%NekoScripts%\*.cmd" /a:-d /b') do call :PACKFILE "%%i"
echo.
call :LIST
goto END
:CLEAR
call :_RemoveData all
goto END
:EXTRACT
set "stSelect=%2"
set stSelect=%stSelect:~1%
if /i "%stSelect%"=="all" (
for /f "usebackq tokens=1,2 delims=:" %%i in ("%~f0") do (
if "%%i"=="nekopack" if not "%%j"=="menu" call :EXTRACTFILE "%%j" "%3")
) else (call :EXTRACTFILE "%2" "%3")
goto END
:PACKFILE
if "%~1"=="%~nx0" goto eof
echo 正在打包:"%NekoScripts%\%~1"
call :COPYFILE "%NekoScripts%\%~1" "%stFileTemp%"
call :_GetDataCount
call :CNTLINES "%stFileTemp%"
set /a nmPackA=%_nmDataCount%+1
set /a nmPackB=%nmPackA%+1
set /a nmPackC=%nmPackA%+%nmLineCount%
call :_InsertData %_nmDataCount% "nekopack:%~n1:%nmPackB%:%nmPackC%"
call :_InsertFile %nmPackA% "%stFileTemp%"
goto eof
:EXTRACTFILE
if "%~2"=="" goto eof
if not "%~3"=="" goto eof
for /f "usebackq tokens=1,2,3,4 delims=:" %%i in ("%~f0") do (
if "%%i"=="nekopack" if "%%j"=="%~n1" (
set nmExtractA=%%k
set nmExtractB=%%l
set nmExtractC=EXIST))
if not "%nmExtractC%"=="EXIST" (echo '%~n1' 不存在。
goto eof)
if not exist "%~2" mkdir "%~2"
cd /d "%~2" >nul 2>nul
if %errorlevel% equ 1 goto eof
call :_GetDataSegLoc
set /a nmExtractA+=%_nmDataSegLocA%-1
set /a nmExtractB+=%_nmDataSegLocA%-1
set /a nmTempCount=0
cd.>".\%~n1.cmd"
echo 释放文件:"%~f1.cmd"
for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~f0"') do (set /a nmTempCount+=1
set "stTemp=%%i"
setlocal enabledelayedexpansion
if !nmTempCount! geq %nmExtractA% if !nmTempCount! leq %nmExtractB% (
echo;!stTemp:*:__=!>>".\%~n1.cmd")
endlocal)
goto eof
:COPYFILE
if "%~2"=="" goto eof
if exist "%~2" del /f "%~2"
cd.>"%~2"
for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~1"') do (
set "stTemp=%%i"
setlocal enabledelayedexpansion
echo;__!stTemp:*:=!>>"%~2"
endlocal)
goto eof
:CNTLINES
set /a nmLineCount=0
for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~1"') do set /a nmLineCount+=1
goto eof
:END
if not "%stFileTemp%"=="" if exist "%stFileTemp%" del /f "%stFileTemp%"
set stSelect=
set nmListA=
set nmListB=
set nmLineCount=
set nmTempCount=
set nmPackA=
set nmPackB=
set nmPackC=
set nmExtractA=
set nmExtractB=
set nmExtractC=
set stFileTemp=
set stTemp=
goto _SetClear
::main_ends
::code_segment
goto eof
:_PrintHelp
::syntax _void :return _return(_GetCodeSegLoc)
call :_GetCodeSegLoc
set /a _nmTempCount=0
for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~f0"') do (set /a _nmTempCount+=1
set "_stTempOri=%%i"
setlocal enabledelayedexpansion
set "_stTempOri=!_stTempOri:*:=!"
if !_nmTempCount! geq %_nmCodeSegLocA% if !_nmTempCount! leq %_nmCodeSegLocB% (
set "_stTempIns=!_stTempOri:~0,1!"
set "_stTempOri=!_stTempOri:~1!"
if "!_stTempIns!"==":" echo !_stTempOri!
)
endlocal)
goto eof
:_SetInit
::syntax _void :return _stNekoVer, _stFileTemp, _stFindStrCmd
set _stNekoVer=20110226
set _stFileTemp=%temp%\%~n0.tmp
set _stFindStrCmd=findstr /i /n
goto eof
:_SetClear
::syntax _void :return _void
set _nmTempDataLoc=
set _nmTempCount=
set _nmTempInsStart=
set _nmTempInsLoc=
set _stTempIns=
set _stTempOri=
set _nmTempRemoveA=
set _nmTempRemoveB=
set _nmTempPrintA=
set _nmTempPrintB=
set _nmTempUpdateA=
set _nmTempUpdateB=
if not "%_stFileTemp%"=="" if exist "%_stFileTemp%" del /f "%_stFileTemp%"
set _stNekoVer=
set _stFileTemp=
set _stFindStrCmd=
set _nmCodeSegLocA=
set _nmCodeSegLocB=
set _nmDataSegLocA=
set _nmDataSegLocB=
set _nmDataCount=
set _nmFindData=
set _stData=
goto eof
:_GetCodeSegLoc
::syntax _void :return _nmAbs(_nmCodeSegLocA), _nmAbs(_nmCodeSegLocB)
for /f "delims=:" %%i in ('%_stFindStrCmd% /x /c:"::code_segment" "%~f0"') do set /a _nmCodeSegLocA=%%i+1
for /f "delims=:" %%i in ('%_stFindStrCmd% /x /c:"::code_ends" "%~f0"') do set /a _nmCodeSegLocB=%%i-1
goto eof
:_GetDataSegLoc
::syntax _void :return _nmAbs(_nmDataSegLocA), _nmAbs(_nmDataSegLocB)
for /f "delims=:" %%i in ('%_stFindStrCmd% /x /c:"::data_segment" "%~f0"') do set /a _nmDataSegLocA=%%i+1
for /f "delims=:" %%i in ('%_stFindStrCmd% /x /c:"::data_ends" "%~f0"') do set /a _nmDataSegLocB=%%i-1
goto eof
:_GetDataCount
::syntax _void :return _return(_GetDataSegLoc), _nmRel(_nmDataCount)
call :_GetDataSegLoc
set /a _nmDataCount=1+%_nmDataSegLocB%-%_nmDataSegLocA%
goto eof
:_FindData
::syntax _st(%~1) :return _nmAbs(_nmFindData)
set /a _nmFindData=0
for /f "delims=:" %%i in ('%_stFindStrCmd% /x /c:"%~1" "%~f0"') do set /a _nmFindData=%%i
goto eof
:_GetData
::syntax _nmRel(%~1) :return _return(_GetDataCount), _stData
call :_GetDataCount
if %~1 lss 1 goto eof
if %~1 gtr %_nmDataCount% goto eof
set /a _nmTempDataLoc=%~1+%_nmDataSegLocA%-1
set /a _nmTempCount=0
for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~f0"') do (set /a _nmTempCount+=1
set "_stTempOri=%%i"
setlocal enabledelayedexpansion
if !_nmTempCount! equ %_nmTempDataLoc% echo;!_stTempOri:*:=!>"%_stFileTemp%"
endlocal)
for /f "usebackq delims=" %%i in ("%_stFileTemp%") do set "_stData=%%i"
goto eof
:_InsertData
::syntax _nmRel(%~1), _st(%~2) :return _return(_GetDataSegLoc)
call :_GetDataSegLoc
set /a _nmTempInsStart=%_nmDataSegLocA%-1
set /a _nmTempInsLoc=%~1+%_nmDataSegLocA%-1
if %_nmTempInsLoc% lss %_nmTempInsStart% goto eof
if %_nmTempInsLoc% gtr %_nmDataSegLocB% goto eof
set "_stTempIns=%~1:%~2"
cd.>"%_stFileTemp%"
set /a _nmTempCount=0
for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~f0"') do (set /a _nmTempCount+=1
set "_stTempOri=%%i"
setlocal enabledelayedexpansion
if !_nmTempCount! leq %_nmTempInsLoc% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
if !_nmTempCount! equ %_nmTempInsLoc% echo;!_stTempIns:*:=!>>"%_stFileTemp%"
if !_nmTempCount! gtr %_nmTempInsLoc% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
endlocal)
type "%_stFileTemp%">"%~f0"
goto eof
:_InsertFile
::syntax _nmRel(%~1), _st(%~2) :return _return(_GetDataSegLoc)
call :_GetDataSegLoc
set /a _nmTempInsStart=%_nmDataSegLocA%-1
set /a _nmTempInsLoc=%~1+%_nmDataSegLocA%-1
if %_nmTempInsLoc% lss %_nmTempInsStart% goto eof
if %_nmTempInsLoc% gtr %_nmDataSegLocB% goto eof
if not exist "%~2" goto eof
set "_stTempIns=%~2"
cd.>"%_stFileTemp%"
set /a _nmTempCount=0
for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~f0"') do (set /a _nmTempCount+=1
set "_stTempOri=%%i"
setlocal enabledelayedexpansion
if !_nmTempCount! leq %_nmTempInsLoc% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
if !_nmTempCount! equ %_nmTempInsLoc% type "%_stTempIns%">>"%_stFileTemp%"
if !_nmTempCount! gtr %_nmTempInsLoc% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
endlocal)
type "%_stFileTemp%">"%~f0"
goto eof
:_RemoveData
::syntax _st(%~1), _nmRel(%~1), _nmRel(%~2) :return _return(_GetDataSegLoc)
call :_GetDataSegLoc
if /i "%~1"=="all" (set /a _nmTempRemoveA=%_nmDataSegLocA%
set /a _nmTempRemoveB=%_nmDataSegLocB%
) else (set /a _nmTempRemoveA=%~1+%_nmDataSegLocA%-1
set /a _nmTempRemoveB=%~2+%_nmDataSegLocA%-1)
if %_nmTempRemoveA% lss %_nmDataSegLocA% goto eof
if %_nmTempRemoveA% gtr %_nmDataSegLocB% goto eof
if %_nmTempRemoveB% lss %_nmDataSegLocA% goto eof
if %_nmTempRemoveB% gtr %_nmDataSegLocB% goto eof
if %_nmTempRemoveA% gtr %_nmTempRemoveB% goto eof
cd.>"%_stFileTemp%"
set /a _nmTempCount=0
for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~f0"') do (set /a _nmTempCount+=1
set "_stTempOri=%%i"
setlocal enabledelayedexpansion
if !_nmTempCount! lss %_nmTempRemoveA% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
if !_nmTempCount! gtr %_nmTempRemoveB% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
endlocal)
type "%_stFileTemp%">"%~f0"
goto eof
:_PrintData
::syntax _st(%~1), _nmRel(%~1), _st(%~2), _nmRel(%~2), _st(%~3) :return _return(_GetDataSegLoc)
call :_GetDataSegLoc
if /i "%~1"=="all" (set /a _nmTempPrintA=%_nmDataSegLocA%
set /a _nmTempPrintB=%_nmDataSegLocB%
) else (set /a _nmTempPrintA=%~1+%_nmDataSegLocA%-1
set /a _nmTempPrintB=%~2+%_nmDataSegLocA%-1)
if %_nmTempPrintA% lss %_nmDataSegLocA% goto eof
if %_nmTempPrintA% gtr %_nmDataSegLocB% goto eof
if %_nmTempPrintB% lss %_nmDataSegLocA% goto eof
if %_nmTempPrintB% gtr %_nmDataSegLocB% goto eof
if %_nmTempPrintA% gtr %_nmTempPrintB% goto eof
set /a _nmTempCount=0
for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~f0"') do (set /a _nmTempCount+=1
set "_stTempOri=%%i"
setlocal enabledelayedexpansion
if !_nmTempCount! geq %_nmTempPrintA% if !_nmTempCount! leq %_nmTempPrintB% (
set /a _nmTempCount=!_nmTempCount!-%_nmDataSegLocA%+1
if /i "%~3"=="noline" (echo;!_stTempOri:*:=!) else (echo;!_nmTempCount! !_stTempOri:*:=!))
endlocal)
goto eof
:_WriteCode
::syntax _st(%~1) :return _void
call :_GetCodeSegLoc
if not exist "%~1" goto eof
if /i "%~1"=="%~f0" goto eof
set _nmTempUpdateA=
set _nmTempUpdateB=
for /f "delims=:" %%i in ('%_stFindStrCmd% /x /c:"::code_segment" "%~1"') do set /a _nmTempUpdateA=%%i+1
for /f "delims=:" %%i in ('%_stFindStrCmd% /x /c:"::code_ends" "%~1"') do set /a _nmTempUpdateB=%%i-1
if "%_nmTempUpdateA%"=="" goto eof
if "%_nmTempUpdateB%"=="" goto eof
if %_nmTempUpdateA% geq %_nmTempUpdate% goto eof
cd.>"%_stFileTemp%"
set /a _nmTempCount=0
for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~1"') do (set /a _nmTempCount+=1
set "_stTempOri=%%i"
setlocal enabledelayedexpansion
if !_nmTempCount! lss %_nmTempUpdateA% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
endlocal)
set /a _nmTempCount=0
for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~f0"') do (set /a _nmTempCount+=1
set "_stTempOri=%%i"
setlocal enabledelayedexpansion
if !_nmTempCount! geq %_nmCodeSegLocA% if !_nmTempCount! leq %_nmCodeSegLocB% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
endlocal)
set /a _nmTempCount=0
for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~1"') do (set /a _nmTempCount+=1
set "_stTempOri=%%i"
setlocal enabledelayedexpansion
if !_nmTempCount! gtr %_nmTempUpdateB% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
endlocal)
type "%_stFileTemp%">"%~1"
goto eof
::code_ends
::data_segment
nekopack:menu:2:34
NekoScripts 包中可用命令列表 更新于 2011/03/02 周三
ATTPM 快速设置文件/文件夹系统属性
BRMOUNT 磁盘卷备份/恢复向导
CE 循环执行程序
CLEAR 清除屏幕
CLOCK 电子表
CNTLINES 文本文件行数统计
DATA 数据程序示例
DELSUBST 清除所有由 SUBST 命令指派的驱动器
DIRCOMP 目录结构比较工具
EDIT 文本文件编辑器
FCOPY 末尾强制标准化文本文件复制
FLSKV 可移动磁盘防病毒扫描程序
GLASSCMD 启用命令提示符磨砂玻璃效果
IPV6 快速设置交大校内 IPv6 翻墙站点
J 文件夹快速跳跃工具
LL 列表查看目录和文件
M4 启动 4 个 MPICH2 并行进程
MYCMD 命令提示符
N 快速打开和编辑文本文件
NEKOPACK 查看,打包和安装 NekoScripts 命令集
O 快速打开文件夹
X 执行命令并退出命令行
READ 文本分页显示工具
SCDEDIT 隐藏目录数据存储编辑器
SETNTSHELL 更改 Windows NT Shell
SHOW_PERCENT 进度条演示程序
SHOW_TITLE 标题动画演示
SHOW_WINXP Windows XP 启动进度条演示
SPLITEXT 文本文件分割工具
SRCHSTR 字符串搜索工具
VDIR 文件夹判断程序
X 执行命令并退出命令行
nekopack:attpm:36:65
__@echo off
__if /i "%*"=="/nekolist" (echo ATTPM 快速设置文件/文件夹系统属性
__goto EOF)
__if "%2"=="" goto NOSYNX
__if /i "%1"=="+" goto ADD
__if /i "%1"=="-" goto REMOVE
__goto ERSYNX
__
__:NOSYNX
__echo 命令格式
__echo attpm + [filename] 快速添加系统文件属性
__echo attpm - [filename] 快速删除系统文件属性
__goto EOF
__
__:ADD
__echo 文件:%2
__attrib %2 +s +h +r -a
__goto DONE
__
__:REMOVE
__echo 文件:%2
__attrib %2 -s -h -r -a
__goto DONE
__
__:DONE
__echo.
__echo 操作成功完成。
__goto EOF
__
__:EOF
nekopack:brmount:67:449
__@echo off
__rem Shanghai Jiaotong University
__rem Coded by Neko, 2007-2011. All rights reserved.
__rem ==============================================
__if /i "%*"=="/nekolist" (echo BRMOUNT 磁盘卷备份/恢复向导
__goto EOF)
__if exist %SystemRoot%\System32\BRMWIZ32.EXE goto GUI
__set xmver=2.00.6225
__set XMTA=磁盘卷 备份/恢复 向导 [版本 %xmver%]
__set XMTBak=磁盘卷备份向导 [版本 %xmver%]
__set XMTRec=磁盘卷恢复向导 [版本 %xmver%]
__set XMTB=Coded by neko, 2007. All rights reserved.
__cls
__echo %XMTA%
__echo %XMTB%
__set XMTA=
__echo.
__echo 此向导只能在管理员级别的命令提示符下执行。
__echo 要强制结束处理进程,请按组合键 Ctrl+C 。
__echo.
__goto ChosTask
__:ChosTask
__set /p BR="请选择一项任务[1=备份 2=恢复 3=退出]: "
__if "%BR%"=="" goto ChosTask
__if "%BR%"=="1" goto Bak01
__if "%BR%"=="2" goto Rec01
__if "%BR%"=="3" goto EOF
__goto ChosTask
__:Bak01
__set BR=
__set XMTRec=
__cls
__echo %XMTBak%
__echo %XMTB%
__echo.
__goto GetBakDr
__:GetBakDr
__rem 获取源卷盘符。
__set BakDrv=
__set /p BakDrv="请输入要备份的卷的盘符: "
__if "%BakDrv%"=="" goto GetBakDr
__if exist %BakDrv%: (
__for /f "tokens=1 delims=:" %%x in ("%Systemroot%") do @if %%x==%BakDrv% (
__echo 该卷是当前系统所在的分区,不能执行备份。请重新指定。
__goto GetBakDr
__) else (
__echo.
__goto TrgWIMF
__)
__) else (
__echo 卷 %BakDrv%: 不存在。
__)
__goto GetBakDr
__:TrgWIMF
__rem 获取目标文件位置。
__set TrgWF=
__set /p TrgWF="请指定要保存的镜像文件的地址和文件名: "
__if "%TrgWF%"=="" goto TrgWIMF
__if exist %TrgWF% (
__echo.
__echo 目标文件已经存在。
__goto TWFExs
__) else (
__echo Test This WIM File >>%TrgWF%
__if not exist %TrgWF% (
__goto TrgWIMF
__) else (
__set DWEF=0
__del %TrgWF%
__goto GetDesc
__)
__)
__goto TrgWIMF
__:TWFExs
__set DWEF=
__set /p DWEF="请选择[1=覆盖文件 2=添加为子集 3=重新指定]: "
__if "%DWEF%"=="" goto TWFExs
__if "%DWEF%"=="3" goto TrgWIMF
__if "%DWEF%"=="1" goto GetDesc
__if "%DWEF%"=="2" goto GetDesc
__goto TWFExs
__:GetDesc
__echo.
__set /p BDesc="请输入镜像文件的描述语: "
__if "%BDesc%"=="" goto GetDesc
__echo.
__echo 扫描待备份的卷可以卸下该卷并检查磁盘错误。
__goto ChkBDrv
__goto GetDesc
__:ChkBDrv
__set BScan=
__set /p BScan="是否扫描卷 %BakDrv%: [Y/N]? "
__if "%BScan%"=="" goto ChkBDrv
__echo.
__goto MSBInf
__:MSBInf
__if "%BScan%"=="Y" (set BSDes=是) else (set BSDes=否)
__if "%BScan%"=="y" (set BSDes=是) else (set BSDes=否)
__set BScan=
__cls
__echo %XMTBak%
__echo %XMTB%
__echo.
__echo 确认信息
__echo ==========
__echo 待备份的卷 %BakDrv%:
__echo 扫描目标卷 %BSDes%
__echo 目标文件 %TrgWF%
__if %DWEF%==1 echo [目标文件已存在,将其覆盖]
__if %DWEF%==2 echo [目标文件已存在,将向该文件中添加一个镜像子集]
__echo 镜像描述语 %BDesc%
__echo.
__goto MSBYN
__:MSBYN
__set BakYN=
__set /p BakYN="是否开始备份[Y/N]? "
__if "%BakYN%"=="" goto MSBYN
__if "%BakYN%"=="Y" goto StartBak
__if "%BakYN%"=="y" goto StartBak
__if "%BakYN%"=="N" goto EOF
__if "%BakYN%"=="n" goto EOF
__goto MSBYN
__:StartBak
__if %BSDes%==否 goto IBak
__if %BSDes%==是 goto ChkBD
__goto EOF
__:ChkBD
__cls
__echo %XMTBak%
__echo %XMTB%
__echo.
__echo 正在执行:扫描卷 %BakDrv%: ...
__echo.
__rem ******
__CHKDSK %BakDrv%: /R /X
__echo.
__goto IBak
__:IBak
__cls
__echo %XMTBak%
__echo %XMTB%
__echo.
__echo 正在执行:备份卷 %BakDrv%: ...
__echo.
__rem ******
__set XMTA=
__set XMTBak=
__set XMTRec=
__set XMTB=
__set BR=
__set BScan=
__set BSDes=
__if %DWEF%==2 ImageX /compress max /append %BakDrv%: %TrgWF% "%BDesc%"
__if %DWEF%==0 ImageX /compress max /capture %BakDrv%: %TrgWF% "%BDesc%"
__if %DWEF%==1 ImageX /compress max /capture %BakDrv%: %TrgWF% "%BDesc%"
__echo.
__goto ChkBR
__:ChkBR
__if exist %TrgWF% echo 备份完成。
__if not exist %TrgWF% echo 备份失败。
__goto EOF
__:Rec01
__set BR=
__set XMTBak=
__cls
__echo %XMTRec%
__echo %XMTB%
__echo.
__goto GetWIMF
__:GetWIMF
__set SourF=
__set /p SourF="请指定镜像文件的地址: "
__if "%SourF%"=="" goto GetWIMF
__if not exist %SourF% (
__echo 文件不存在。请重新指定。
__) else (
__echo.
__goto WIMIndex
__)
__goto GetWIMF
__:WIMIndex
__set WIMInd=
__set /p WIMInd="请选择镜像文件子集序号[通常为 1 ]: "
__if "%WIMInd%"=="" goto WIMIndex
__echo.
__goto GetRecDr
__:GetRecDr
__set RecDrv=
__set /p RecDrv="请输入要恢复的卷的盘符: "
__if "%RecDrv%"=="" goto GetRecDr
__if exist %RecDrv%: (
__for /f "tokens=1 delims=:" %%x in ("%Systemroot%") do @if %%x==%RecDrv% (
__echo 该卷是当前系统所在的分区,不能执行备份。请重新指定。
__goto GetRecDr
__) else (
__echo.
__goto ShowCF
__)
__) else (
__echo 卷 %RecDrv%: 不存在。
__goto GetRecDr
__)
__goto GetRecDr
__:ShowCF
__cls
__echo %XMTRec%
__echo %XMTB%
__echo.
__echo 格式化选项
__echo ==========
__echo 0 = 不格式化
__echo 1 = 格式化为 NTFS
__echo 2 = 快速格式化为 NTFS
__echo 3 = 格式化为 FAT
__echo 4 = 快速格式化为 FAT
__echo 5 = 格式化为 FAT32
__echo 6 = 快速格式化为 FAT32
__echo.
__goto RecFmt
__:RecFmt
__set FmtFS=
__set /p FmtFS="请选择格式化方案: "
__if "%FmtFS%"=="" goto RecFmt
__if "%FmtFS%"=="0" set FmtDz=不格式化该卷
__if "%FmtFS%"=="1" set FmtDz=格式化为 NTFS
__if "%FmtFS%"=="2" set FmtDz=快速格式化为 NTFS
__if "%FmtFS%"=="3" set FmtDz=格式化为 FAT
__if "%FmtFS%"=="4" set FmtDz=快速格式化为 FAT
__if "%FmtFS%"=="5" set FmtDz=格式化为 FAT32
__if "%FmtFS%"=="6" set FmtDz=快速格式化为 FAT32
__echo.
__if %FmtFS%==0 goto RecBoot
__if %FmtFS%==1 goto RecBoot
__if %FmtFS%==2 goto RecBoot
__if %FmtFS%==3 goto RecBoot
__if %FmtFS%==4 goto RecBoot
__if %FmtFS%==5 goto RecBoot
__if %FmtFS%==6 goto RecBoot
__goto RecFmt
__:RecBoot
__set WRecB=
__set /p WRecB="是否向该卷写入引导数据[Y/N]? "
__if "%WRecB%"=="" goto RecBoot
__if "%WRecB%"=="Y" set WBoot=是
__if "%WRecB%"=="y" set WBoot=是
__if "%WRecB%"=="N" set WBoot=否
__if "%WRecB%"=="n" set WBoot=否
__if "%WRecB%"=="Y" goto IChkRec
__if "%WRecB%"=="y" goto IChkRec
__if "%WRecB%"=="N" goto IChkRec
__if "%WRecB%"=="n" goto IChkRec
__goto RecBoot
__:IChkRec
__if not %FmtFS%==0 goto StartRec
__set iCRec=
__set /p iCRec="是否在恢复卷之前扫描磁盘[Y/N]? "
__if "%iCRec%"=="Y" set CRec=是
__if "%iCRec%"=="y" set CRec=是
__if "%iCRec%"=="N" set CRec=否
__if "%iCRec%"=="n" set CRec=否
__if %CRec%==是 goto StartRec
__if %CRec%==否 goto StartRec
__goto IChkRec
__:StartRec
__if "%CRec%"=="" set CRec=Blank
__cls
__echo %XMTRec%
__echo %XMTB%
__echo.
__echo 确认信息
__echo ==========
__echo 待恢复的卷 %RecDrv%:
__echo %FmtDz%
__if %CRec%==否 echo 扫描磁盘 否
__if %CRec%==是 echo 扫描磁盘 是
__echo 写入引导数据 %WBoot%
__echo 镜像文件 %SourF%
__echo 子集序号 %WIMInd%
__echo.
__set FmtDz=
__set ChkRec=
__goto MSRYN
__:MSRYN
__set RecYN=
__set /p RecYN="是否开始恢复数据[Y/N]? "
__if "%RecYN%"=="" goto MSRYN
__if "%RecYN%"=="Y" goto StartRec
__if "%RecYN%"=="y" goto StartRec
__if "%RecYN%"=="N" goto EOF
__if "%RecYN%"=="n" goto EOF
__goto MSRYN
__:StartRec
__if %FmtFS%==0 goto StrCR
__cls
__echo %XMTRec%
__echo %XMTB%
__echo.
__echo 正在执行:格式化卷 %RecDrv%: ...
__echo.
__rem ******
__if %FmtFS%==1 format %RecDrv%: /fs:ntfs /x
__if %FmtFS%==2 format %RecDrv%: /fs:ntfs /q /x
__if %FmtFS%==3 format %RecDrv%: /fs:fat /x
__if %FmtFS%==4 format %RecDrv%: /fs:fat /q /x
__if %FmtFS%==5 format %RecDrv%: /fs:fat32 /x
__if %FmtFS%==6 format %RecDrv%: /fs:fat32 /q /x
__goto IMRec
__:StrCR
__if %CRec%==否 goto IMRec
__cls
__echo %XMTRec%
__echo %XMTB%
__echo.
__echo 正在执行:扫描卷 %RecDrv%: ...
__echo.
__rem ******
__chkdsk %RecDrv%: /R /X
__goto IMRec
__chkdsk %RecDrv%
__:IMRec
__cls
__echo %XMTRec%
__echo %XMTB%
__echo.
__echo 正在执行:恢复数据到卷 %RecDrv%: ...
__echo.
__rem ******
__ImageX /apply %SourF% %WIMInd% %RecDrv%:
__if %WBoot%==否 (
__echo 执行完毕。
__goto EOF
__) else (
__goto Wrb
__)
__goto Wrb
__:Wrb
__cls
__echo %XMTRec%
__echo %XMTB%
__echo.
__echo 正在执行:写入引导数据到卷 %RecDrv%: ...
__echo.
__rem ******
__if not exist %RecDrv%:\bootmgr (
__if not exist %RecDrv%:\ntldr (
__echo.
__echo 卷 %RecDrv%: 没有可用的引导文件。
__goto EOF
__)
__)
__if exist %RecDrv%:\bootmgr Bootsect /nt60 %RecDrv%:
__if exist %RecDrv%:\ntldr Bootsect /nt52 %RecDrv%:
__echo.
__echo 执行完毕。
__goto EOF
__:GUI
__%SystemRoot%\System32\BRMWIZ32.EXE
__goto EOF
__
__:EOF
__set XMTA=
__set XMTBak=
__set XMTRec=
__set XMTB=
__set xmver=
__set BR=
__set BakDrv=
__set TrgWF=
__set DWEF=
__set BDesc=
__set BScan=
__set BSDes=
__set BakYN=
__set SourF=
__set FmtFS=
__set FmtDz=
__set WRecB=
__set ChkRec=
__set WBoot=
__set iCRec=
__set CRec=
__set WIMInd=
__set RecYN=
nekopack:ce:451:463
__::循环执行程序
__::Coded by neko, 2010. All rights reserved.
__
__@echo off
__if /i "%*"=="/nekolist" (echo CE 循环执行程序
__goto EOF)
__goto BEGIN
__
__:BEGIN
__call %*
__goto BEGIN
__
__:EOF
nekopack:clear:465:471
__@echo off
__if /i "%*"=="/nekolist" (echo CLEAR 清除屏幕
__goto EOF)
__cls %*
__goto EOF
__
__:EOF
nekopack:clock:473:482
__@echo off
__if /i "%*"=="/nekolist" (echo CLOCK 电子表
__goto EOF)
__call glasscmd.cmd
__mode con:cols=16 lines=2
__echo %date%
__:START
__for /f "delims=. tokens=1" %%i in ("%time%") do set /p=%%i<nul
__goto START
__:EOF
nekopack:cntlines:484:499
__::文本文件行数统计
__::Coded by neko, 2010. All rights reserved.
__
__@echo off
__if /i "%*"=="/nekolist" (echo CNTLINES 文本文件行数统计
__goto EOF)
__if "%1"=="" (echo 未指定文件。
__goto EOF)
__if not exist "%1" goto EOF
__set nmLineCount=0
__for /f "delims=" %%i in ('findstr /n .* %1') do set /a nmLineCount+=1
__echo %nmLineCount% %1
__set nmLineCount=
__goto EOF
__
__:EOF
nekopack:data:501:717
__@echo off
__if /i "%1"=="/nekolist" (echo DATA 数据程序示例
__goto eof)
__
__::main_segment
__call :_SetInit
__call :_%*
__call :_SetClear
__::main_ends
__
__::code_segment
__goto eof
__:_PrintHelp
__::syntax _void :return _return(_GetCodeSegLoc)
__call :_GetCodeSegLoc
__set /a _nmTempCount=0
__for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~f0"') do (set /a _nmTempCount+=1
__set "_stTempOri=%%i"
__setlocal enabledelayedexpansion
__set "_stTempOri=!_stTempOri:*:=!"
__if !_nmTempCount! geq %_nmCodeSegLocA% if !_nmTempCount! leq %_nmCodeSegLocB% (
__set "_stTempIns=!_stTempOri:~0,1!"
__set "_stTempOri=!_stTempOri:~1!"
__if "!_stTempIns!"==":" echo !_stTempOri!
__)
__endlocal)
__goto eof
__:_SetInit
__::syntax _void :return _stNekoVer, _stFileTemp, _stFindStrCmd
__set _stNekoVer=20110226
__set _stFileTemp=%temp%\%~n0.tmp
__set _stFindStrCmd=findstr /i /n
__goto eof
__:_SetClear
__::syntax _void :return _void
__set _nmTempDataLoc=
__set _nmTempCount=
__set _nmTempInsStart=
__set _nmTempInsLoc=
__set _stTempIns=
__set _stTempOri=
__set _nmTempRemoveA=
__set _nmTempRemoveB=
__set _nmTempPrintA=
__set _nmTempPrintB=
__set _nmTempUpdateA=
__set _nmTempUpdateB=
__if not "%_stFileTemp%"=="" if exist "%_stFileTemp%" del /f "%_stFileTemp%"
__set _stNekoVer=
__set _stFileTemp=
__set _stFindStrCmd=
__set _nmCodeSegLocA=
__set _nmCodeSegLocB=
__set _nmDataSegLocA=
__set _nmDataSegLocB=
__set _nmDataCount=
__set _nmFindData=
__set _stData=
__goto eof
__:_GetCodeSegLoc
__::syntax _void :return _nmAbs(_nmCodeSegLocA), _nmAbs(_nmCodeSegLocB)
__for /f "delims=:" %%i in ('%_stFindStrCmd% /x /c:"::code_segment" "%~f0"') do set /a _nmCodeSegLocA=%%i+1
__for /f "delims=:" %%i in ('%_stFindStrCmd% /x /c:"::code_ends" "%~f0"') do set /a _nmCodeSegLocB=%%i-1
__goto eof
__:_GetDataSegLoc
__::syntax _void :return _nmAbs(_nmDataSegLocA), _nmAbs(_nmDataSegLocB)
__for /f "delims=:" %%i in ('%_stFindStrCmd% /x /c:"::data_segment" "%~f0"') do set /a _nmDataSegLocA=%%i+1
__for /f "delims=:" %%i in ('%_stFindStrCmd% /x /c:"::data_ends" "%~f0"') do set /a _nmDataSegLocB=%%i-1
__goto eof
__:_GetDataCount
__::syntax _void :return _return(_GetDataSegLoc), _nmRel(_nmDataCount)
__call :_GetDataSegLoc
__set /a _nmDataCount=1+%_nmDataSegLocB%-%_nmDataSegLocA%
__goto eof
__:_FindData
__::syntax _st(%~1) :return _nmAbs(_nmFindData)
__set /a _nmFindData=0
__for /f "delims=:" %%i in ('%_stFindStrCmd% /x /c:"%~1" "%~f0"') do set /a _nmFindData=%%i
__goto eof
__:_GetData
__::syntax _nmRel(%~1) :return _return(_GetDataCount), _stData
__call :_GetDataCount
__if %~1 lss 1 goto eof
__if %~1 gtr %_nmDataCount% goto eof
__set /a _nmTempDataLoc=%~1+%_nmDataSegLocA%-1
__set /a _nmTempCount=0
__for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~f0"') do (set /a _nmTempCount+=1
__set "_stTempOri=%%i"
__setlocal enabledelayedexpansion
__if !_nmTempCount! equ %_nmTempDataLoc% echo;!_stTempOri:*:=!>"%_stFileTemp%"
__endlocal)
__for /f "usebackq delims=" %%i in ("%_stFileTemp%") do set "_stData=%%i"
__goto eof
__:_InsertData
__::syntax _nmRel(%~1), _st(%~2) :return _return(_GetDataSegLoc)
__call :_GetDataSegLoc
__set /a _nmTempInsStart=%_nmDataSegLocA%-1
__set /a _nmTempInsLoc=%~1+%_nmDataSegLocA%-1
__if %_nmTempInsLoc% lss %_nmTempInsStart% goto eof
__if %_nmTempInsLoc% gtr %_nmDataSegLocB% goto eof
__set "_stTempIns=%~1:%~2"
__cd.>"%_stFileTemp%"
__set /a _nmTempCount=0
__for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~f0"') do (set /a _nmTempCount+=1
__set "_stTempOri=%%i"
__setlocal enabledelayedexpansion
__if !_nmTempCount! leq %_nmTempInsLoc% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
__if !_nmTempCount! equ %_nmTempInsLoc% echo;!_stTempIns:*:=!>>"%_stFileTemp%"
__if !_nmTempCount! gtr %_nmTempInsLoc% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
__endlocal)
__type "%_stFileTemp%">"%~f0"
__goto eof
__:_InsertFile
__::syntax _nmRel(%~1), _st(%~2) :return _return(_GetDataSegLoc)
__call :_GetDataSegLoc
__set /a _nmTempInsStart=%_nmDataSegLocA%-1
__set /a _nmTempInsLoc=%~1+%_nmDataSegLocA%-1
__if %_nmTempInsLoc% lss %_nmTempInsStart% goto eof
__if %_nmTempInsLoc% gtr %_nmDataSegLocB% goto eof
__if not exist "%~2" goto eof
__set "_stTempIns=%~2"
__cd.>"%_stFileTemp%"
__set /a _nmTempCount=0
__for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~f0"') do (set /a _nmTempCount+=1
__set "_stTempOri=%%i"
__setlocal enabledelayedexpansion
__if !_nmTempCount! leq %_nmTempInsLoc% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
__if !_nmTempCount! equ %_nmTempInsLoc% type "%_stTempIns%">>"%_stFileTemp%"
__if !_nmTempCount! gtr %_nmTempInsLoc% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
__endlocal)
__type "%_stFileTemp%">"%~f0"
__goto eof
__:_RemoveData
__::syntax _st(%~1), _nmRel(%~1), _nmRel(%~2) :return _return(_GetDataSegLoc)
__call :_GetDataSegLoc
__if /i "%~1"=="all" (set /a _nmTempRemoveA=%_nmDataSegLocA%
__set /a _nmTempRemoveB=%_nmDataSegLocB%
__) else (set /a _nmTempRemoveA=%~1+%_nmDataSegLocA%-1
__set /a _nmTempRemoveB=%~2+%_nmDataSegLocA%-1)
__if %_nmTempRemoveA% lss %_nmDataSegLocA% goto eof
__if %_nmTempRemoveA% gtr %_nmDataSegLocB% goto eof
__if %_nmTempRemoveB% lss %_nmDataSegLocA% goto eof
__if %_nmTempRemoveB% gtr %_nmDataSegLocB% goto eof
__if %_nmTempRemoveA% gtr %_nmTempRemoveB% goto eof
__cd.>"%_stFileTemp%"
__set /a _nmTempCount=0
__for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~f0"') do (set /a _nmTempCount+=1
__set "_stTempOri=%%i"
__setlocal enabledelayedexpansion
__if !_nmTempCount! lss %_nmTempRemoveA% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
__if !_nmTempCount! gtr %_nmTempRemoveB% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
__endlocal)
__type "%_stFileTemp%">"%~f0"
__goto eof
__:_PrintData
__::syntax _st(%~1), _nmRel(%~1), _st(%~2), _nmRel(%~2), _st(%~3) :return _return(_GetDataSegLoc)
__call :_GetDataSegLoc
__if /i "%~1"=="all" (set /a _nmTempPrintA=%_nmDataSegLocA%
__set /a _nmTempPrintB=%_nmDataSegLocB%
__) else (set /a _nmTempPrintA=%~1+%_nmDataSegLocA%-1
__set /a _nmTempPrintB=%~2+%_nmDataSegLocA%-1)
__if %_nmTempPrintA% lss %_nmDataSegLocA% goto eof
__if %_nmTempPrintA% gtr %_nmDataSegLocB% goto eof
__if %_nmTempPrintB% lss %_nmDataSegLocA% goto eof
__if %_nmTempPrintB% gtr %_nmDataSegLocB% goto eof
__if %_nmTempPrintA% gtr %_nmTempPrintB% goto eof
__set /a _nmTempCount=0
__for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~f0"') do (set /a _nmTempCount+=1
__set "_stTempOri=%%i"
__setlocal enabledelayedexpansion
__if !_nmTempCount! geq %_nmTempPrintA% if !_nmTempCount! leq %_nmTempPrintB% (
__set /a _nmTempCount=!_nmTempCount!-%_nmDataSegLocA%+1
__if /i "%~3"=="noline" (echo;!_stTempOri:*:=!) else (echo;!_nmTempCount! !_stTempOri:*:=!))
__endlocal)
__goto eof
__:_WriteCode
__::syntax _st(%~1) :return _void
__call :_GetCodeSegLoc
__if not exist "%~1" goto eof
__if /i "%~1"=="%~f0" goto eof
__set _nmTempUpdateA=
__set _nmTempUpdateB=
__for /f "delims=:" %%i in ('%_stFindStrCmd% /x /c:"::code_segment" "%~1"') do set /a _nmTempUpdateA=%%i+1
__for /f "delims=:" %%i in ('%_stFindStrCmd% /x /c:"::code_ends" "%~1"') do set /a _nmTempUpdateB=%%i-1
__if "%_nmTempUpdateA%"=="" goto eof
__if "%_nmTempUpdateB%"=="" goto eof
__if %_nmTempUpdateA% geq %_nmTempUpdate% goto eof
__cd.>"%_stFileTemp%"
__set /a _nmTempCount=0
__for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~1"') do (set /a _nmTempCount+=1
__set "_stTempOri=%%i"
__setlocal enabledelayedexpansion
__if !_nmTempCount! lss %_nmTempUpdateA% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
__endlocal)
__set /a _nmTempCount=0
__for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~f0"') do (set /a _nmTempCount+=1
__set "_stTempOri=%%i"
__setlocal enabledelayedexpansion
__if !_nmTempCount! geq %_nmCodeSegLocA% if !_nmTempCount! leq %_nmCodeSegLocB% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
__endlocal)
__set /a _nmTempCount=0
__for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~1"') do (set /a _nmTempCount+=1
__set "_stTempOri=%%i"
__setlocal enabledelayedexpansion
__if !_nmTempCount! gtr %_nmTempUpdateB% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
__endlocal)
__type "%_stFileTemp%">"%~1"
__goto eof
__::code_ends
__
__::data_segment
__data 01
__data 02
__data 03
__::data_ends
__
__:eof
nekopack:delsubst:719:731
__@echo off
__if /i "%*"=="/nekolist" (echo DELSUBST 清除所有由 SUBST 命令指派的驱动器
__goto EOF)
__
__for /f "delims=:" %%i in ('subst') do (
__set "stDriveLetter=%%i"
__setlocal enabledelayedexpansion
__subst !stDriveLetter!: /d
__endlocal)
__set stDriveLetter=
__goto EOF
__
__:EOF
nekopack:dircomp:733:755
__@echo off
__if /i "%*"=="/nekolist" (echo DIRCOMP 目录结构比较工具
__goto EOF)
__if "%2"=="" goto NOSYNC
__set stTempFileA=%temp%\dc1.tmp
__set stTempFileB=%temp%\dc2.tmp
__
__cd.>"%stTempFileA%"
__cd.>"%stTempFileB%"
__tree "%1">>"%stTempFileA%"
__tree "%2">>"%stTempFileB%"
__fc "%stTempFileA%" "%stTempFileB%"
__goto EOF
__
__:NOSYNC
__echo 命令格式:%0 [dir1] [dir2]
__goto EOF
__
__:EOF
__if exist "%stTempFileA%" del "%stTempFileA%" /f
__if exist "%stTempFileB%" del "%stTempFileB%" /f
__set stTempFileA=
__set stTempFileB=
nekopack:edit:757:1199
__::1.0实现基本编辑功能(行编辑)
__::1.1实现文本分页式浏览
__::1.2实现基本编辑功能(段编辑)
__::1.3实现结构简洁化(代码优化)
__::1.4back指令可以跳转到具体某行
__::1.5函数化构建
__::1.6可处理空行
__::1.7可输出特殊字符
__::1.8结构优化;可输入特殊字符;检验:可编辑自身
__::1.9增加预设变量,解决嵌套bug
__
__@echo off
__if /i "%*"=="/nekolist" (echo EDIT 文本文件编辑器
__goto EOF)
__if /i "%1"=="/verify" goto VERIFY
__rem if exist "%systemroot%\system32\notepad.exe" (
__rem start %systemroot%\system32\notepad.exe %*
__rem goto EOF)
__:START
__call :END
__
__::临时文件
__set tempfile=%temp%\edit.tmp
__::控制入口
__set ctrcmd=#con
__::分页行数
__set pline=20
__::执行命令
__set cmdedit=off
__::保存备份文件
__set makebak=off
__::启动帮助
__set startmenu=off
__::自动返回
__set autoback=on
__
__::文件名设定
__if not "%1"=="" (set filename=%1
__goto EDITEXIST)
__echo 文本编辑 [版本 2.0.0120]
__echo Coded by neko, 2010. All rights reserved.
__if "%startmenu%"=="on" goto HELP
__goto CONTROL
__
__:CONTROL
__echo.
__:CONTRNL
__set ecmd=
__set editprompt=
__for /f %%i in ('cd') do set editprompt=%%i
__if "%cmdedit%"=="on" (set /p ecmd="edit %editprompt%>"
__) else (set /p ecmd="edit>")
__set editprompt=
__:CONTREL
__if exist "%tempfile%.1" for /f "delims=" %%i in ('findstr /n .* "%tempfile%.1"') do set "ecmd=%%i"
__if "%ecmd%"=="" goto CONTRNL
__if exist "%tempfile%.1" set "ecmd=%ecmd:*:=%"
__if exist "%tempfile%.1" del "%tempfile%.1" /f
__for /f "tokens=1" %%i in ("%ecmd%") do set ecmdf=%%i
__for /f "tokens=2" %%i in ("%ecmd%") do set ecmd1=%%i
__for /f "tokens=3" %%i in ("%ecmd%") do set ecmd2=%%i
__::调试命令
__if /i "%ecmdf%"=="init" (cls
__goto START)
__if /i "%ecmdf%"=="debug" (
__set
__goto CONTROL)
__if not "%cmdedit%"=="on" (
__if /i "%ecmdf%"=="e" goto EXPERR
__if /i "%ecmdf%"=="s" goto EXPERR
__if /i "%ecmdf%"=="se" goto EXPERR
__if /i "%ecmdf%"=="set" goto EXPERR
__call :EXPSHORT
__)
__::文件操作
__if /i "%ecmdf%"=="new" (
__set filename=%ecmd1%
__if "%ecmd1%"=="" set filename=新建文本文档.txt
__goto CREATENEW
__)
__if /i "%ecmdf%"=="open" (
__if "%ecmd1%"=="" (
__if "%filename%"=="" goto NOPEN
__echo 当前编辑的文件为 '%filename%'
__goto CONTROL)
__set filename=%ecmd1%
__goto EDITEXIST
__)
__if /i "%ecmdf%"=="save" (
__if "%filename%"=="" goto NOPEN
__if "%ecmd1%"=="" goto SAVEFILE
__set filename=%ecmd1%
__goto SAVEFILE)
__)
__if /i "%ecmdf%"=="back" (
__if "%filename%"=="" goto NOPEN
__set ecmd1=
__goto READFILE
__)
__if /i "%ecmdf%"=="help" goto HELP
__if /i "%ecmdf%"=="exit" goto END
__::编辑操作
__if /i "%ecmdf%"=="goto" (
__if "%filename%"=="" goto NOPEN
__if "%ecmd1%"=="" goto NOLINE
__goto READFILE
__)
__if /i "%ecmdf%"=="insert" goto INSERT
__if /i "%ecmdf%"=="delete" goto DELETE
__if /i "%ecmdf%"=="edline" goto LEDIT
__::程序设置
__if /i "%ecmdf%"=="cmdlines" (
__if /i "%ecmd1%"=="on" (set cmdedit=on) else (set cmdedit=off)
__goto CONTRNL
__)
__if /i "%ecmdf%"=="setlines" goto SETLINES
__if /i "%ecmdf%"=="setentry" (
__if "%ecmd1%"=="" goto CONTROL
__set ctrcmd=%ecmd1%
__goto CONTRNL
__)
__if /i "%ecmdf%"=="settings" (
__echo 临时文件 %tempfile%
__echo 控制入口 %ctrcmd%
__echo 分页行数 %pline%
__if "%cmdedit%"=="on" (echo 执行命令 已启用) else (echo 执行命令 已禁用)
__if "%makebak%"=="on" (echo 保存备份 已启用) else (echo 保存备份 已禁用)
__if "%startmenu%"=="on" (echo 启动帮助 已启用) else (echo 启动帮助 已禁用)
__if "%autoback%"=="on" (echo 自动返回 已启用) else (echo 自动返回 已禁用)
__goto CONTROL
__)
__::非法命令处理
__if "%ecmdf%"=="%ctrcmd%" (echo 当前已经处于控制状态。
__goto CONTROL)
__if "%cmdedit%"=="on" (call %ecmd%) else (
__echo '%ecmdf%' 不是有效指令,请键入 help 查询控制命令。)
__goto CONTROL
__
__:EXPSHORT
__set "ecmds=%ecmdf:~0,4%"
__if /i "%ecmds%"=="setl" set ecmdf=setlines
__if /i "%ecmds%"=="sete" set ecmdf=setentry
__if /i "%ecmds%"=="sett" set ecmdf=settings
__set "ecmds=%ecmdf:~0,2%"
__if /i "%ecmds%"=="ed" set ecmdf=edline
__if /i "%ecmds%"=="ex" set ecmdf=exit
__if /i "%ecmds%"=="sa" set ecmdf=save
__set "ecmds=%ecmdf:~0,1%"
__if /i "%ecmds%"=="n" set ecmdf=new
__if /i "%ecmds%"=="o" set ecmdf=open
__if /i "%ecmds%"=="b" set ecmdf=back
__if /i "%ecmds%"=="h" set ecmdf=help
__if /i "%ecmds%"=="g" set ecmdf=goto
__if /i "%ecmds%"=="i" set ecmdf=insert
__if /i "%ecmds%"=="d" set ecmdf=delete
__if /i "%ecmds%"=="c" set ecmdf=cmdlines
__goto EOF
__
__:EXPERR
__echo 二义性命令。
__goto CONTROL
__
__:NOPEN
__if exist "%tempfile%" del "%tempfile%" /f
__if exist "%tempfile%.1" del "%tempfile%.1" /f
__echo 未打开任何可编辑的文件。
__goto CONTROL
__
__:NOLINE
__echo 指定的行数不正确。
__goto CONTROL
__
__:SAVEFILE
__if "%filename%"=="" goto NOPEN
__if "%makebak%"=="on" (
__if exist "%filename%.bak" del "%filename%.bak" /f
__if exist "%filename%" move "%filename%" "%filename%.bak" >nul 2>nul
__if exist "%filename%.bak" (echo 备份文件 '%filename%.bak' 已保存。
__) else (echo 备份文件 '%filename%.bak' 保存失败。)
__) else (if exist "%filename%" del "%filename%" /f)
__copy "%tempfile%" "%filename%" >nul 2>nul
__if exist "%filename%" (echo 文件 '%filename%' 已保存。
__) else (echo 文件 '%filename%' 保存失败。)
__goto EDITEXIST
__
__:COUNTEXIST
__for /f %%i in ('findstr /n .* "%tempfile%"') do set /a tline+=1
__goto EOF
__
__:SETLINES
__if "%ecmd1%"=="" goto CONTROL
__if %ecmd1% LEQ 0 goto CONTROL
__set pline=%ecmd1%
__goto CONTRNL
__
__:HELP
__echo.
__echo 新建 new [文件名]
__echo 打开 open [文件名]
__echo 保存 save [文件名]
__echo 返回 back
__echo 帮助 help
__echo 退出 exit
__echo.
__echo 跳转 goto [行号]
__echo 插入 insert [行号]
__echo 编辑 edline [行号]
__echo 删除 delete [起始行号] [终止行号]
__echo.
__echo 命令行开关 cmdlines [on^|off]
__echo 分页行数设置 setlines [分页行数]
__echo 控制入口设置 setentry [控制入口字符串]
__echo 显示设置值 settings
__echo.
__echo 控制状态提示符为“edit^>”,编辑状态提示符为“行号: ”
__echo 在编辑状态中,输入“^%ctrcmd%”进入控制状态。
__goto CONTROL
__
__:INSERT
__set /a tline+=1
__if "%ecmd1%"=="" set ecmd1=%tline%
__if "%filename%"=="" goto NOPEN
__if not "%ecmd1%" GTR "0" goto NOLINE
__if not %ecmd1% LEQ %tline% (
__set /a tline-=1
__goto NOLINE)
__set /a tline-=1
__echo.
__cd.>"%tempfile%.1"
__set /a line=0
__for /f "delims=" %%i in ('findstr /n .* "%tempfile%"') do (set /a line+=1
__set "str=%%i"
__setlocal enabledelayedexpansion
__if !line! LSS %ecmd1% echo;!str:*:=!>>"%tempfile%.1"
__endlocal)
__set str=
__set /a line=%ecmd1%-1
__:INSPARA
__set /a line+=1
__set cLine=
__set /p cLine="%line%: "
__setlocal enabledelayedexpansion
__if not "!cLine!"=="%ctrcmd%" (
__echo;!cLine!>>"%tempfile%.1"
__endlocal
__goto INSPARA)
__endlocal
__set cLine=
__set /a line=0
__for /f "delims=" %%i in ('findstr /n .* "%tempfile%"') do (set /a line+=1
__set "str=%%i"
__setlocal enabledelayedexpansion
__if !line! GEQ %ecmd1% echo;!str:*:=!>>"%tempfile%.1"
__endlocal)
__set str=
__set line=
__if exist "%tempfile%" del "%tempfile%" /f
__move "%tempfile%.1" "%tempfile%" >nul 2>nul
__set ecmd1=
__if "%autoback%"=="on" goto READFILE
__call :COUNTEXIST
__goto CONTROL
__
__:DELETE
__if "%filename%"=="" goto NOPEN
__if "%ecmd1%"=="" goto NOLINE
__if "%ecmd2%"=="" goto NOLINE
__if %ecmd1% LEQ 0 goto NOLINE
__if %ecmd2% LSS %ecmd1% goto NOLINE
__if %ecmd1% GTR %tline% goto NOLINE
__if %ecmd2% GTR %tline% goto NOLINE
__cd.>"%tempfile%.1"
__set /a line=0
__for /f "delims=" %%i in ('findstr /n .* "%tempfile%"') do (set /a line+=1
__set "str=%%i"
__setlocal enabledelayedexpansion
__if !line! LSS %ecmd1% echo;!str:*:=!>>"%tempfile%.1"
__if !line! GTR %ecmd2% echo;!str:*:=!>>"%tempfile%.1"
__endlocal)
__set str=
__if exist "%tempfile%" del "%tempfile%" /f
__move "%tempfile%.1" "%tempfile%" >nul 2>nul
__set line=
__set ecmd1=
__set ecmd2=
__if "%autoback%"=="on" goto READFILE
__call :COUNTEXIST
__goto CONTROL
__
__:LEDIT
__if "%ecmd1%"=="" goto NOLINE
__if "%filename%"=="" goto NOPEN
__if %ecmd1% LEQ 0 goto NOLINE
__if %ecmd1% GTR %tline% goto NOLINE
__echo.
__set /a line=0
__for /f "delims=" %%i in ('findstr /n .* "%tempfile%"') do (set /a line+=1
__set "str=%%i"
__setlocal enabledelayedexpansion
__if !line! EQU %ecmd1% echo %ecmd1%: !str:*:=!
__endlocal)
__set str=
__set cLine=
__set /p cLine="%ecmd1%: "
__set /a line=0
__cd.>"%tempfile%.1"
__for /f "delims=" %%i in ('findstr /n .* "%tempfile%"') do (set /a line+=1
__set "str=%%i"
__setlocal enabledelayedexpansion
__if !line! LSS %ecmd1% echo;!str:*:=!>>"%tempfile%.1"
__if !line! EQU %ecmd1% echo;!cLine!>>"%tempfile%.1"
__if !line! GTR %ecmd1% echo;!str:*:=!>>"%tempfile%.1"
__endlocal)
__set line=
__set cLine=
__set str=
__if exist "%tempfile%" del "%tempfile%" /f
__move "%tempfile%.1" "%tempfile%" >nul 2>nul
__set ecmd1=
__if "%autoback%"=="on" goto READFILE
__call :COUNTEXIST
__goto CONTROL
__
__:CREATENEW
__echo.
__echo 创建文本 - %filename%
__set ecmd1=1
__set tline=0
__cd.>"%tempfile%"
__goto INSERT
__
__:EDITEXIST
__if not exist "%filename%" (
__echo 文件 '%filename%' 不存在。
__echo.
__setlocal enabledelayedexpansion
__set yn=
__set /p yn="是否打开编辑?[y/n] "
__if /i "!yn!"=="y" (endlocal
__set yn=
__goto CREATENEW) else (if "%1"=="%filename%" (endlocal
__set yn=
__goto END))
__endlocal
__set yn=
__set filename=
__goto CONTROL)
__cd.>"%tempfile%"
__for /f "delims=" %%i in ('findstr /n .* "%filename%"') do (
__set "str=%%i"
__setlocal enabledelayedexpansion
__echo;!str:*:=!>>"%tempfile%"
__endlocal)
__set str=
__set ecmd1=
__goto READFILE
__
__:READFILE
__echo.
__echo 编辑文本 - %filename%
__echo.
__set /a line=0
__set /a tline=0
__call :COUNTEXIST
__if "%tline%"=="0" (echo 文件为空或者无法正确识别。
__echo.
__setlocal enabledelayedexpansion
__set yn=
__set /p yn="是否打开编辑?[y/n] "
__if /i "!yn!"=="y" (endlocal
__set yn=
__set tline=0
__set ecmd1=1
__goto INSERT)
__endlocal
__set yn=
__goto CONTROL)
__if "%ecmd1%"=="" set ecmd1=1
__if %ecmd1% LEQ 0 goto NOLINE
__if %ecmd1% GTR %tline% goto NOLINE
__for /f "delims=" %%i in ('findstr /n .* "%tempfile%"') do (set /a line+=1
__set "str=%%i"
__setlocal enabledelayedexpansion
__if !line! GEQ %ecmd1% (
__echo !line!: !str:*:=!
__set /a turn=!line!-%ecmd1%+1
__set /a turn=!turn!%%pline%
__if !line! LSS %tline% if !turn! EQU 0 (
__set /a perc=!line!*100/%tline%
__echo [!line!/%tline%] !perc!%%
__set ecmd=
__set /p ecmd="按回车进入下一页 edit>"
__if not "!ecmd!"=="" (
__echo;!ecmd!>"%tempfile%.1"
__endlocal
__set line=
__set str=
__set ecmd1=
__goto CONTREL)
__echo.)
__)
__endlocal
__)
__set line=
__set str=
__set ecmd1=
__goto CONTROL
__
__:END
__if exist "%tempfile%" del "%tempfile%" /f
__if exist "%tempfile%.1" del "%tempfile%.1" /f
__set tempfile=
__set ctrcmd=
__set pline=
__set cmdedit=
__set makebak=
__set startmenu=
__set autoback=
__set filename=
__set tline=
__set ecmd=
__set ecmdf=
__set ecmds=
__goto EOF
__
__:VERIFY
__echo 文本编辑校验模式
__set inputfile=%temp%\edit.inscript
__set outputfile=%temp%\edit.output
__if exist "%outputfile%" del "%outputfile%" /f
__cd.>"%inputfile%"
__echo new>>"%inputfile%"
__type %~f0>>"%inputfile%"
__echo #con>>"%inputfile%"
__echo save %outputfile%>>"%inputfile%"
__echo exit>>"%inputfile%"
__call %~f0 < "%inputfile%"
__if exist "%inputfile%" del "%inputfile%" /f
__call read.cmd fc %~f0 "%outputfile%"
__if exist "%outputfile%" del "%outputfile%" /f
__goto EOF
__
__:EOF
nekopack:fcopy:1201:1216
__@echo off
__if /i "%1"=="/nekolist" (echo FCOPY 末尾强制标准化文本文件复制
__goto EOF)
__
__if "%2"=="" goto EOF
__if exist "%2" del /f "%2"
__cd.>"%2"
__for /f "delims=" %%i in ('findstr /n /i .* "%1"') do (
__set "stTemp=%%i"
__setlocal enabledelayedexpansion
__echo;!stTemp:*:=!>>"%2"
__endlocal)
__set stTemp=
__goto EOF
__
__:EOF
nekopack:flskv:1218:1321
__@echo off
__if /i "%*"=="/nekolist" (echo FLSKV 可移动磁盘防病毒扫描程序
__goto eof)
__set blExecutive=off
__title 可移动磁盘防病毒扫描程序
__echo 可移动磁盘防病毒扫描程序 [版本 1.1.0024]
__echo Coded by neko, 2010. All rights reserved.
__
__::统计数值
__set stFileCount=%temp%\countf.tmp
__set stFileKillList=%temp%\kilist.tmp
__cd.>"%stFileKillList%"
__::起始目录
__::for /f %%i in ('cd') do set stPath=%%~di
__set stPath=%cd%
__::清除列表
__echo bat>>"%stFileKillList%"
__echo com>>"%stFileKillList%"
__echo exe>>"%stFileKillList%"
__echo inf>>"%stFileKillList%"
__echo js>>"%stFileKillList%"
__echo jse>>"%stFileKillList%"
__echo lnk>>"%stFileKillList%"
__echo msc>>"%stFileKillList%"
__echo pif>>"%stFileKillList%"
__echo vbe>>"%stFileKillList%"
__echo vbs>>"%stFileKillList%"
__echo wsf>>"%stFileKillList%"
__echo wsh>>"%stFileKillList%"
__goto BEGIN
__
__:CLINE
__set /p=<nul
__goto eof
__
__::执行流程
__:BEGIN
__echo.
__echo 扫描目标 %stPath%,
__set /p=执行:枚举文件.<nul
__dir /a /b /s "%stPath%" 1>"%stFileCount%" 2>nul
__set nmTotal=0
__for /f "usebackq delims=" %%i in ("%stFileCount%") do (
__set /a nmTotal+=1
__setlocal enabledelayedexpansion
__set /a nmFactor=!nmTotal!%%100
__if !nmFactor! equ 0 set /p= .<nul
__set /a nmFactor=!nmTotal!%%600
__if !nmFactor! equ 0 (
__call :CLINE
__set /p=执行:枚举文件. <nul
__set /p=<nul
__)
__endlocal)
__call :CLINE
__echo 待处理项 %nmTotal% 个。
__echo.
__echo 执行:扫描文件. . .
__echo.
__set nmScanned=0
__for /f "usebackq delims=" %%i in ("%stFileCount%") do (
__if not "%%i"=="" (
__for /f "usebackq delims=" %%j in ("%stFileKillList%") do (
__if /i "%%~xi"==".%%j" (
__setlocal enabledelayedexpansion
__set "stTemp=%%~nxi "
__set stTemp=!stTemp:~0,40!
__echo !stTemp!
__endlocal
__if "%blExecutive%"=="on" (
__attrib "%%i" -s -h -r -a
__mkdir "\backup%%~pi">nul 2>nul
__move "%%i" "\backup%%~pi">nul 2>nul
__)
__))
__set /a nmScanned+=1
__setlocal enabledelayedexpansion
__set /a nmPercent=!nmScanned!*100/%nmTotal%
__set "stTemp=[!nmPercent!%%] %%~nxi "
__set stTemp=!stTemp:~0,40!
__set /p=!stTemp!<nul
__title 扫描进度 !nmPercent!%%
__call :CLINE
__if !nmPercent! equ 100 (endlocal
__goto END)
__endlocal
__)
__)
__goto END
__
__:END
__echo 扫描了 %nmScanned% 个文件/文件夹。
__title Coded by neko, 2010.
__set stPath=
__set nmTotal=
__set nmScanned=
__if exist "%stFileCount%" del "%stFileCount%" /f
__if exist "%stFileKillList%" del "%stFileKillList%" /f
__set stFileCount=
__set stFileKillList=
__set blExecutive=
__goto eof
__
__:eof
nekopack:glasscmd:1323:1336
__@echo off
__if /i "%*"=="/nekolist" (echo GLASSCMD 启用命令提示符磨砂玻璃效果
__goto EOF)
__
__start glasscmd.exe
__echo.
__echo Loading GlassCMD . . .
__echo.
__for /L %%i in (1 1 60) do set /p=^><nul&sleepx 1
__cls
__start pskill glasscmd.exe
__goto EOF
__
__:EOF
nekopack:ipv6:1338:1351
__@echo off
__if /i "%*"=="/nekolist" (echo IPV6 快速设置交大校内 IPv6 翻墙站点
__goto EOF)
__cd /d c:\windows\system32\drivers\etc
__if "%1"=="off" (netsh interface ipv6 isatap set state disabled
__ren hosts hosts.ipv6
__ren hosts.bak hosts
__) else (
__netsh interface ipv6 isatap set state enabled
__ren hosts hosts.bak
__ren hosts.ipv6 hosts)
__goto EOF
__
__:EOF
nekopack:j:1353:1416
__@echo off
__if /i "%*"=="/nekolist" (echo J 文件夹快速跳跃工具
__goto eof)
__if /i "%*"=="" (echo NEKO_GOTO_SCRIPTS
__set stOldPath=%cd%
__cd /d "%NekoScripts%"
__goto eof)
__if /i "%*"=="/b" (echo NEKO_GO_BACK
__if "%stOldPath%"=="" goto eof
__cd /d "%stOldPath%"
__goto eof)
__if /i "%*"=="/s" goto NEKO_SET_PATH_TEMP
__:::::::::::::::::::::::::::::::::::::
__if /i "%*"=="-t" (echo NEKO_GOTO_LMMS_TOOLKIT
__cd /d "D:\Projects\lmms\toolkit"
__goto eof)
__if /i "%*"=="-e" (
__if not exist e: (
__echo NEKO_OPEN_DRIVE_E
__echo select disk ^0>"%temp%\~j.tmp"
__echo select partition ^3>>"%temp%\~j.tmp"
__echo assign letter=e>>"%temp%\~j.tmp"
__echo exit>>"%temp%\~j.tmp"
__diskpart <"%temp%\~j.tmp"
__if exist "%temp%\~j.tmp" del "%temp%\~j.tmp" /f
__cd /d E:\
__) else (
__echo NEKO_CLOSE_DRIVE_E
__echo select disk ^0>"%temp%\~j.tmp"
__echo select partition ^3>>"%temp%\~j.tmp"
__echo remove>>"%temp%\~j.tmp"
__echo exit>>"%temp%\~j.tmp"
__diskpart < "%temp%\~j.tmp"
__if exist "%temp%\~j.tmp" del "%temp%\~j.tmp" /f
__cd /d "%NekoScripts%"
__)
__goto eof)
__if /i "%*"=="-m" goto NEKOGOTOMASM
__:::::::::::::::::::::::::::::::::::::
__set /a nmTempCount=0
__for /f "delims=" %%i in ('dir /a:d /b %**') do (set /a nmTempCount+=1
__set "stNewPath=%%i")
__if %nmTempCount% EQU 1 (echo NEKO_QUICK_JUMPER
__cd "%stNewPath%")
__if %nmTempCount% GTR 1 dir /a:d /b %**
__set nmTempCount=
__goto eof
__:::::::::::::::::::::::::::::::::::::
__:NEKOSETPATHTEMP
__echo NEKO_SET_PATH_TEMP
__set "NekoScripts=%cd%"
__set "path=%path%;%NekoScripts%"
__goto eof
__:NEKOGOTOMASM
__if "%nekomasmset%"=="true" goto NEKOGOTOMASMGO
__set "nekomasmset=true"
__set "nekomasm=d:\process\masm"
__set "include=%nekomasm%\masm32\include"
__set "lib=%nekomasm%\masm32\lib"
__set "path=%path%;%nekomasm%\masm32\bin"
__:NEKOGOTOMASMGO
__cd /d "%nekomasm%\code"
__goto eof
__:eof
nekopack:ll:1418:1430
__@echo off
__if /i "%*"=="/nekolist" (echo LL 列表查看目录和文件
__goto EOF)
__set stFileTemp=%temp%\fx.tmp
__echo;%1>"%stFileTemp%"
__for /f "delims=" %%i in ('dir /a:d /b %1') do echo %%~ai %%~ti %%~zi %%i>>"%stFileTemp%"
__echo.>>"%stFileTemp%"
__for /f "delims=" %%i in ('dir /a:-d /b %1') do echo %%~ai %%~ti %%~zi %%i>>"%stFileTemp%"
__if /i "%1"=="/p" (call read %stFileTemp%) else (type %stFileTemp%)
__if exist "%stFileTemp%" del "%stFileTemp%" /f
__set stFileTemp=
__goto EOF
__:EOF
nekopack:m4:1432:1438
__@echo off
__if /i "%*"=="/nekolist" (echo M4 启动 4 个 MPICH2 并行进程
__goto EOF)
__
__mpiexec -np 4 %*
__
__:EOF
nekopack:mycmd:1440:1459
__@echo off
__if /i "%*"=="/nekolist" (echo MYCMD 命令提示符
__goto EOF)
__if "%*"=="" (echo 命令提示符
__echo Coded by Neko, 2011. All rights reserved.
__echo.
__set "stMyCmdLine=") else (set "stMyCmdLine=%*")
__
__:MYCONTROL
__for /f %%i in ('cd') do set stMyPrompt=%%i
__if "%stMyCmdLine%"=="" set /p stMyCmdLine="NEKO %stMyPrompt%>"
__if "%stMyCmdLine%"=="exit" goto EOF
__call %stMyCmdLine%
__if not "%stMyCmdLine%"=="" echo.
__set stMyCmdLine=
__goto MYCONTROL
__
__:EOF
__set stMyPrompt=
__set stMyCmdLine=
nekopack:n:1461:1481
__::记事本调用程序
__::Coded by neko, 2010. All rights reserved.
__@echo off
__if /i "%*"=="/nekolist" (echo N 快速打开和编辑文本文件
__goto EOF)
__if "%*"=="" (start notepad.exe
__goto EOF)
__set /a nmFileCount=0
__for /f "delims=" %%i in ('dir /a:-d /b %1*') do (set /a nmFileCount+=1
__set "stFileName=%%i")
__if %nmFileCount% equ 1 (start notepad.exe "%stFileName%"
__goto EOF)
__if "%2"=="/f" (copy nul "%1">nul
__start notepad.exe "%1"
__goto EOF)
__if %nmFileCount% gtr 1 dir /a:-d /b "%1*"
__goto EOF
__
__:EOF
__set nmFileCount=
__set stFileName=
nekopack:o:1483:1492
__@echo off
__if /i "%*"=="/nekolist" (echo O 快速打开文件夹
__goto EOF)
__
__if "%1"=="" (call explorer .
__) else (
__call explorer %1)
__goto EOF
__
__:EOF
nekopack:q:1494:1494
__@x.cmd %*
nekopack:read:1496:1590
__@echo off
__if /i "%*"=="/nekolist" (echo READ 文本分页显示工具
__goto EOF)
__if "%1"=="" goto HELP
__if "%1"=="/?" goto HELP
__::每次显示的行数
__set /a pline=23
__::临时文件
__set tempfile=%temp%\read.tmp
__::入口处理
__set ecmd1=1
__
__if not exist "%1" goto RCMDL
__set filename=%1
__goto RFILE
__
__:CONTREL
__if exist "%tempfile%.1" for /f "delims=" %%i in ('findstr /n .* "%tempfile%.1"') do set "ecmd=%%i"
__set ecmd=%ecmd:*:=%
__if exist "%tempfile%.1" del "%tempfile%.1" /f
__set /a ecmd1=%ecmd%
__set ecmd=
__if %ecmd1% LEQ 0 goto NOLINE
__if %ecmd1% GTR %tline% goto NOLINE
__goto RFILE
__
__:NOLINE
__rem echo.
__rem echo 行号不正确。
__goto EOF
__
__:RCMDL
__%*>"%tempfile%"
__set filename=%tempfile%
__if not exist "%filename%" goto EOF
__goto RFILE
__
__:RFILE
__echo.
__echo 分页显示 - %*
__echo Coded by neko, 2010. All rights reserved.
__echo.
__set tline=0
__for /f "delims=" %%i in ('findstr /n .* "%filename%"') do set /a tline+=1
__set line=0
__for /f "delims=" %%i in ('findstr /n .* "%filename%"') do (set /a line+=1
__set "str=%%i"
__setlocal enabledelayedexpansion
__if !line! GEQ %ecmd1% (
__set /a turn=!line!-%ecmd1%+1
__set /a turn=!turn!%%pline%
__echo !line!: !str:*:=!
__::if !line! EQU %tline% pause
__if !line! LSS %tline% if !turn! EQU 0 (
__set /a perc=!line!*100/%tline%
__echo [!line!/%tline%] !perc!%%
__set ecmd=
__set /p ecmd="按回车进入下一页 >"
__if not "!ecmd!"=="" (
__if exist "%tempfile%.1" del "%tempfile%.1" /f
__echo;!ecmd!>>"%tempfile%.1"
__set perc=
__set line=
__set str=
__endlocal
__goto CONTREL)
__echo.)
__)
__endlocal
__)
__set str=
__set line=
__set ecmd1=
__goto EOF
__
__:HELP
__echo.
__echo 显示文件内容
__echo 示例:read abc.txt
__echo.
__echo 显示命令输出
__echo 示例:read help
__goto EOF
__
__:EOF
__if exist "%tempfile%" del /f "%tempfile%"
__if exist "%tempfile%.1" del /f "%tempfile%.1"
__set tempfile=
__set filename=
__set pline=
__set line=
__set tline=
__set ecmd=
__set ecmd1=
__set str=
nekopack:scdedit:1592:1909
__@echo off
__if /i "%1"=="/nekolist" (echo SCDEDIT 隐藏目录数据存储编辑器
__goto eof)
__
__::main_segment
__set rGUID={645FF040-5081-101B-9F08-00AA002F954E}
__set rFLAG=0
__call :_SetInit
__if "%1"=="" goto LIST
__if /i "%1"=="/?" goto HELP
__if /i "%1"=="-help" goto HELP
__if /i "%1"=="/help" goto HELP
__if /i "%1"=="-add" goto ADD
__if /i "%1"=="/add" goto ADD
__if /i "%1"=="-remove" goto REMOVE
__if /i "%1"=="/remove" goto REMOVE
__if /i "%1"=="-adcvt" (set rFLAG=1
__goto ADD)
__if /i "%1"=="/adcvt" (set rFLAG=1
__goto ADD)
__if /i "%1"=="-rmcvt" (set rFLAG=1
__goto REMOVE)
__if /i "%1"=="/rmcvt" (set rFLAG=1
__goto REMOVE)
__if /i "%1"=="-list" goto LIST
__if /i "%1"=="/list" goto LIST
__if /i "%1"=="-open" goto OPEN
__if /i "%1"=="/open" goto OPEN
__goto ERRSYNC
__
__:LIST
__echo 隐藏目录列表
__echo.
__call :_GetDataCount
__if %_nmDataCount% equ 0 goto NORECORD
__call :_PrintData ALL
__goto END
__
__:HELP
__echo.
__echo SCDEDIT - 启动隐藏目录数据存储编辑器
__echo.
__echo 命令行参数列表
__echo -help 显示命令帮助,参数0
__echo -list 显示目录数据,参数0
__echo -add 添加目录数据,参数1[路径]
__echo -remove 移除目录数据,参数1[数值]
__echo -adcvt 添加目录数据并转换目录,参数1[路径]
__echo -rmcvt 移除目录数据并还原目录,参数1[数值]
__echo -open 打开隐藏目录,参数1[数值],参数2[盘符]
__goto END
__
__:ADD
__if "%2"=="" goto ERRSYNC
__if not "%3"=="" goto ERRSYNC
__call :_GetDataCount
__call :_FindData "%2"
__if %_nmFindData% neq 0 (echo 指定的项在数据库中已存在。
__goto END)
__if %rFLAG% equ 0 (if not exist "%2.%rGUID%" (echo 目标文件夹 %2.%rGUID% 不存在。
__goto END) else (call :_InsertData %_nmDataCount% "%2"))
__if %rFLAG% equ 1 (if not exist "%2" (echo 目标文件夹 %2 不存在。
__goto END) else (call :_InsertData %_nmDataCount% "%2"
__attrib "%2" -s -h -r -a >nul 2>nul
__move "%2" "%2.%rGUID%" >nul 2>nul
__attrib "%2.%rGUID%" +s +h +r -a))
__echo 操作成功完成。
__goto END
__
__:REMOVE
__if "%2"=="" goto ERRSYNC
__if not "%3"=="" goto ERRSYNC
__call :_GetDataCount
__if %2 lss 1 goto END
__if %2 gtr %_nmDataCount% goto END
__call :_GetData %2
__if %rFLAG% equ 0 (call :_RemoveData %2 %2)
__if %rFLAG% equ 1 (call :_RemoveData %2 %2
__if not exist "%_stData%.%rGUID%" (echo 目标文件夹 %_stData%.%rGUID% 不存在。
__) else (attrib "%_stData%.%rGUID%" -s -h -r -a >nul 2>nul
__move "%_stData%.%rGUID%" "%_stData%" >nul 2>nul))
__echo 操作成功完成。
__goto END
__
__:OPEN
__if "%3"=="" goto ERRSYNC
__if not "%4"=="" goto ERRSYNC
__call :_GetDataCount
__if %2 lss 1 goto END
__if %2 gtr %INFO_DATA_COUNT% goto END
__call :_GetData %2
__if not exist "%_stData%.%rGUID%" (echo 目标文件夹 %_stData%.%rGUID% 不存在。
__) else (subst %3 "%_stData%.%rGUID%" >nul 2>nul
__explorer %3
__echo 已打开指定目录,若要关闭,
__pause
__subst %3 /d)
__echo 操作成功完成。
__goto END
__
__:ERRSYNC
__echo 指定的命令行无效。
__echo 运行 "scdedit /?" 获得命令行帮助。
__goto END
__
__:NORECORD
__echo 没有已记录的隐藏目录。
__goto END
__
__:END
__set rGUID=
__set rFLAG=
__goto _SetClear
__::main_ends
__::code_segment
__goto eof
__:_PrintHelp
__::syntax _void :return _return(_GetCodeSegLoc)
__call :_GetCodeSegLoc
__set /a _nmTempCount=0
__for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~f0"') do (set /a _nmTempCount+=1
__set "_stTempOri=%%i"
__setlocal enabledelayedexpansion
__set "_stTempOri=!_stTempOri:*:=!"
__if !_nmTempCount! geq %_nmCodeSegLocA% if !_nmTempCount! leq %_nmCodeSegLocB% (
__set "_stTempIns=!_stTempOri:~0,1!"
__set "_stTempOri=!_stTempOri:~1!"
__if "!_stTempIns!"==":" echo !_stTempOri!
__)
__endlocal)
__goto eof
__:_SetInit
__::syntax _void :return _stNekoVer, _stFileTemp, _stFindStrCmd
__set _stNekoVer=20110226
__set _stFileTemp=%temp%\%~n0.tmp
__set _stFindStrCmd=findstr /i /n
__goto eof
__:_SetClear
__::syntax _void :return _void
__set _nmTempDataLoc=
__set _nmTempCount=
__set _nmTempInsStart=
__set _nmTempInsLoc=
__set _stTempIns=
__set _stTempOri=
__set _nmTempRemoveA=
__set _nmTempRemoveB=
__set _nmTempPrintA=
__set _nmTempPrintB=
__set _nmTempUpdateA=
__set _nmTempUpdateB=
__if not "%_stFileTemp%"=="" if exist "%_stFileTemp%" del /f "%_stFileTemp%"
__set _stNekoVer=
__set _stFileTemp=
__set _stFindStrCmd=
__set _nmCodeSegLocA=
__set _nmCodeSegLocB=
__set _nmDataSegLocA=
__set _nmDataSegLocB=
__set _nmDataCount=
__set _nmFindData=
__set _stData=
__goto eof
__:_GetCodeSegLoc
__::syntax _void :return _nmAbs(_nmCodeSegLocA), _nmAbs(_nmCodeSegLocB)
__for /f "delims=:" %%i in ('%_stFindStrCmd% /x /c:"::code_segment" "%~f0"') do set /a _nmCodeSegLocA=%%i+1
__for /f "delims=:" %%i in ('%_stFindStrCmd% /x /c:"::code_ends" "%~f0"') do set /a _nmCodeSegLocB=%%i-1
__goto eof
__:_GetDataSegLoc
__::syntax _void :return _nmAbs(_nmDataSegLocA), _nmAbs(_nmDataSegLocB)
__for /f "delims=:" %%i in ('%_stFindStrCmd% /x /c:"::data_segment" "%~f0"') do set /a _nmDataSegLocA=%%i+1
__for /f "delims=:" %%i in ('%_stFindStrCmd% /x /c:"::data_ends" "%~f0"') do set /a _nmDataSegLocB=%%i-1
__goto eof
__:_GetDataCount
__::syntax _void :return _return(_GetDataSegLoc), _nmRel(_nmDataCount)
__call :_GetDataSegLoc
__set /a _nmDataCount=1+%_nmDataSegLocB%-%_nmDataSegLocA%
__goto eof
__:_FindData
__::syntax _st(%~1) :return _nmAbs(_nmFindData)
__set /a _nmFindData=0
__for /f "delims=:" %%i in ('%_stFindStrCmd% /x /c:"%~1" "%~f0"') do set /a _nmFindData=%%i
__goto eof
__:_GetData
__::syntax _nmRel(%~1) :return _return(_GetDataCount), _stData
__call :_GetDataCount
__if %~1 lss 1 goto eof
__if %~1 gtr %_nmDataCount% goto eof
__set /a _nmTempDataLoc=%~1+%_nmDataSegLocA%-1
__set /a _nmTempCount=0
__for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~f0"') do (set /a _nmTempCount+=1
__set "_stTempOri=%%i"
__setlocal enabledelayedexpansion
__if !_nmTempCount! equ %_nmTempDataLoc% echo;!_stTempOri:*:=!>"%_stFileTemp%"
__endlocal)
__for /f "usebackq delims=" %%i in ("%_stFileTemp%") do set "_stData=%%i"
__goto eof
__:_InsertData
__::syntax _nmRel(%~1), _st(%~2) :return _return(_GetDataSegLoc)
__call :_GetDataSegLoc
__set /a _nmTempInsStart=%_nmDataSegLocA%-1
__set /a _nmTempInsLoc=%~1+%_nmDataSegLocA%-1
__if %_nmTempInsLoc% lss %_nmTempInsStart% goto eof
__if %_nmTempInsLoc% gtr %_nmDataSegLocB% goto eof
__set "_stTempIns=%~1:%~2"
__cd.>"%_stFileTemp%"
__set /a _nmTempCount=0
__for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~f0"') do (set /a _nmTempCount+=1
__set "_stTempOri=%%i"
__setlocal enabledelayedexpansion
__if !_nmTempCount! leq %_nmTempInsLoc% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
__if !_nmTempCount! equ %_nmTempInsLoc% echo;!_stTempIns:*:=!>>"%_stFileTemp%"
__if !_nmTempCount! gtr %_nmTempInsLoc% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
__endlocal)
__type "%_stFileTemp%">"%~f0"
__goto eof
__:_InsertFile
__::syntax _nmRel(%~1), _st(%~2) :return _return(_GetDataSegLoc)
__call :_GetDataSegLoc
__set /a _nmTempInsStart=%_nmDataSegLocA%-1
__set /a _nmTempInsLoc=%~1+%_nmDataSegLocA%-1
__if %_nmTempInsLoc% lss %_nmTempInsStart% goto eof
__if %_nmTempInsLoc% gtr %_nmDataSegLocB% goto eof
__if not exist "%~2" goto eof
__set "_stTempIns=%~2"
__cd.>"%_stFileTemp%"
__set /a _nmTempCount=0
__for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~f0"') do (set /a _nmTempCount+=1
__set "_stTempOri=%%i"
__setlocal enabledelayedexpansion
__if !_nmTempCount! leq %_nmTempInsLoc% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
__if !_nmTempCount! equ %_nmTempInsLoc% type "%_stTempIns%">>"%_stFileTemp%"
__if !_nmTempCount! gtr %_nmTempInsLoc% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
__endlocal)
__type "%_stFileTemp%">"%~f0"
__goto eof
__:_RemoveData
__::syntax _st(%~1), _nmRel(%~1), _nmRel(%~2) :return _return(_GetDataSegLoc)
__call :_GetDataSegLoc
__if /i "%~1"=="all" (set /a _nmTempRemoveA=%_nmDataSegLocA%
__set /a _nmTempRemoveB=%_nmDataSegLocB%
__) else (set /a _nmTempRemoveA=%~1+%_nmDataSegLocA%-1
__set /a _nmTempRemoveB=%~2+%_nmDataSegLocA%-1)
__if %_nmTempRemoveA% lss %_nmDataSegLocA% goto eof
__if %_nmTempRemoveA% gtr %_nmDataSegLocB% goto eof
__if %_nmTempRemoveB% lss %_nmDataSegLocA% goto eof
__if %_nmTempRemoveB% gtr %_nmDataSegLocB% goto eof
__if %_nmTempRemoveA% gtr %_nmTempRemoveB% goto eof
__cd.>"%_stFileTemp%"
__set /a _nmTempCount=0
__for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~f0"') do (set /a _nmTempCount+=1
__set "_stTempOri=%%i"
__setlocal enabledelayedexpansion
__if !_nmTempCount! lss %_nmTempRemoveA% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
__if !_nmTempCount! gtr %_nmTempRemoveB% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
__endlocal)
__type "%_stFileTemp%">"%~f0"
__goto eof
__:_PrintData
__::syntax _st(%~1), _nmRel(%~1), _st(%~2), _nmRel(%~2), _st(%~3) :return _return(_GetDataSegLoc)
__call :_GetDataSegLoc
__if /i "%~1"=="all" (set /a _nmTempPrintA=%_nmDataSegLocA%
__set /a _nmTempPrintB=%_nmDataSegLocB%
__) else (set /a _nmTempPrintA=%~1+%_nmDataSegLocA%-1
__set /a _nmTempPrintB=%~2+%_nmDataSegLocA%-1)
__if %_nmTempPrintA% lss %_nmDataSegLocA% goto eof
__if %_nmTempPrintA% gtr %_nmDataSegLocB% goto eof
__if %_nmTempPrintB% lss %_nmDataSegLocA% goto eof
__if %_nmTempPrintB% gtr %_nmDataSegLocB% goto eof
__if %_nmTempPrintA% gtr %_nmTempPrintB% goto eof
__set /a _nmTempCount=0
__for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~f0"') do (set /a _nmTempCount+=1
__set "_stTempOri=%%i"
__setlocal enabledelayedexpansion
__if !_nmTempCount! geq %_nmTempPrintA% if !_nmTempCount! leq %_nmTempPrintB% (
__set /a _nmTempCount=!_nmTempCount!-%_nmDataSegLocA%+1
__if /i "%~3"=="noline" (echo;!_stTempOri:*:=!) else (echo;!_nmTempCount! !_stTempOri:*:=!))
__endlocal)
__goto eof
__:_WriteCode
__::syntax _st(%~1) :return _void
__call :_GetCodeSegLoc
__if not exist "%~1" goto eof
__if /i "%~1"=="%~f0" goto eof
__set _nmTempUpdateA=
__set _nmTempUpdateB=
__for /f "delims=:" %%i in ('%_stFindStrCmd% /x /c:"::code_segment" "%~1"') do set /a _nmTempUpdateA=%%i+1
__for /f "delims=:" %%i in ('%_stFindStrCmd% /x /c:"::code_ends" "%~1"') do set /a _nmTempUpdateB=%%i-1
__if "%_nmTempUpdateA%"=="" goto eof
__if "%_nmTempUpdateB%"=="" goto eof
__if %_nmTempUpdateA% geq %_nmTempUpdate% goto eof
__cd.>"%_stFileTemp%"
__set /a _nmTempCount=0
__for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~1"') do (set /a _nmTempCount+=1
__set "_stTempOri=%%i"
__setlocal enabledelayedexpansion
__if !_nmTempCount! lss %_nmTempUpdateA% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
__endlocal)
__set /a _nmTempCount=0
__for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~f0"') do (set /a _nmTempCount+=1
__set "_stTempOri=%%i"
__setlocal enabledelayedexpansion
__if !_nmTempCount! geq %_nmCodeSegLocA% if !_nmTempCount! leq %_nmCodeSegLocB% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
__endlocal)
__set /a _nmTempCount=0
__for /f "delims=" %%i in ('%_stFindStrCmd% .* "%~1"') do (set /a _nmTempCount+=1
__set "_stTempOri=%%i"
__setlocal enabledelayedexpansion
__if !_nmTempCount! gtr %_nmTempUpdateB% echo;!_stTempOri:*:=!>>"%_stFileTemp%"
__endlocal)
__type "%_stFileTemp%">"%~1"
__goto eof
__::code_ends
__
__::data_segment
__::data_ends
__
__:eof
nekopack:setntshell:1911:1932
__@echo off
__::explorer.exe or cmd.exe
__if /i "%*"=="/nekolist" (echo SETNTSHELL 更改 Windows NT Shell
__goto EOF)
__set "stRegTemp=%temp%\snstemp.reg"
__echo 更改 Windows NT Shell
__echo Coded by neko, 2010. All rights reserved.
__echo Windows Registry Editor Version 5.00 >"%stRegTemp%"
__echo. >>"%stRegTemp%"
__echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon] >>"%stRegTemp%"
__echo "Shell"="%1" >>"%stRegTemp%"
__echo.
__type "%stRegTemp%"
__echo.
__set /p blYesNo="验证信息是否正确?(y/n) "
__if /i "%blYesNo%"=="y" reg import "%stRegTemp%"
__if exist "%stRegTemp%" del "%stRegTemp%" /f
__set stRegTemp=
__set blYesNo=
__goto EOF
__
__:EOF
nekopack:show_percent:1934:1952
__@echo off
__if /i "%*"=="/nekolist" (echo SHOW_PERCENT 进度条演示程序
__goto EOF)
__echo 进度条演示程序
__echo Coded by neko, 2010. All rights reserved.
__echo.
__set /p=[<nul
__::for /l %%i in (1 1 50) do set /p=.<nul
__set /p=- <nul
__set /p=]<nul
__for /l %%i in (1 1 51) do set /p=<nul
__for /l %%i in (1 1 50) do (
__set /p=" =="<nul
__sleepx 50
__)
__echo.
__goto EOF
__
__:EOF
nekopack:show_title:1954:1979
__@echo off
__if /i "%*"=="/nekolist" (echo SHOW_TITLE 标题动画演示
__goto EOF)
__setlocal enabledelayedexpansion %title {s11ss 2007-12-12}%
__call :m "www.cn-dos.net" " " 4 50
__title Press any key to exit...&pause>nul&title %comspec%&exit/b
__:m
__set s=%~1
__set c=%~2
__set n=%3
__set "d=for /l %%z in (1,1,%4) do cd."
__set t=%s%
__:c
__set t=%t:~1%&set/a l+=1
__if not "%t%" equ "" goto :c
__for /l %%a in (1,1,%l%) do %d%&title !s:~0,%%a!
__for /l %%a in (%l%,-1,1) do %d%&title !s:~0,%%a!
__set/a t=%l%-1
__for /l %%a in (1,1,%n%) do set "space=!space!%c%"&for /l %%b in (1,1,%t%) do set s%%b%%a=!s:~0,%%b!!space!!s:~%%b,1!
__for /l %%a in (1,1,%t%) do for /l %%b in (%n%,-1,1) do %d%&title !s%%a%%b!
__title !s!&%d%
__for /l %%a in (%t%,-1,1) do for /l %%b in (1,1,%n%) do %d%&title !s%%a%%b!
__
__goto EOF
__
__:EOF
nekopack:show_winxp:1981:2004
__@echo off
__if /i "%*"=="/nekolist" (echo SHOW_WINXP Windows XP 启动进度条演示
__goto EOF)
__::批处理进度条演示程序
__::Coded by neko, 2010. All rigths reserved.
__
__if "%1"=="" call :CLEAR
__echo.
__for /L %%i in (0,1,77) do set /p=" =="<nul
__for /L %%i in (0,1,78) do set /p=<nul
__for /L %%i in (0,1,78) do (
__sleepx 50
__set /p=^><nul)
__echo.
__cls
__goto EOF
__
__:CLEAR
__cls
__for /l %%i in (1 1 100) do echo.
__echo Windows 正在启动
__goto EOF
__
__:EOF
nekopack:splitext:2006:2072
__@echo off
__if /i "%*"=="/nekolist" (echo SPLITEXT 文本文件分割工具
__goto EOF)
__echo 文本分割 [版本 1.0.0008]
__echo Coded by neko, 2010. All rights reserved.
__echo.
__if "%1"=="" goto NOFILE
__if not exist "%1" goto NOFILE
__set stFileTemp=%temp%\splitext.tmp
__set nmTotalnmCurLine=0
__echo 正在扫描文本
__set /p=[^> ]<nul
__set /p=<nul
__for /f "usebackq delims=" %%i in ("%1") do (set /a nmTotalnmCurLine+=1
__setlocal enabledelayedexpansion
__set /a tt=!nmTotalnmCurLine!%%100
__if !tt! EQU 0 set /p= ^><nul
__set /a tt=!nmTotalnmCurLine!%%1000
__if !tt! EQU 0 (
__set /p=<nul
__set /p=[^> ]<nul
__set /p=<nul
__)
__endlocal)
__set /p=<nul
__echo '%1' 文本总行数 %nmTotalnmCurLine%
__echo.
__if "%2"=="" (set /p nmTotalPart="输出文件数:") else (set "nmTotalPart=%2"
__echo 输出文件数:%2)
__if %nmTotalPart% LEQ 0 goto PERROR
__echo.
__set /a pnmCurLine=%nmTotalnmCurLine%/%nmTotalPart%
__set nmCurLine=0
__echo ^0>"%stFileTemp%"
__set stTemp=
__for /f "usebackq delims=" %%i in ("%1") do (set /a nmCurLine+=1
__set "stTemp=%%i"
__setlocal enabledelayedexpansion
__set /a nmPercent=!nmCurLine!*100/%nmTotalnmCurLine%
__set /p=[!nmPercent!%%]<nul
__for /f "usebackq" %%j in ("%stFileTemp%") do set nmCurPart=%%j
__echo;!stTemp!>>%~n1_!nmCurPart!.txt
__set /a blTurn=!nmCurLine!%%!pnmCurLine!
__if !nmCurLine! LSS %nmTotalnmCurLine% if !blTurn! EQU 0 (
__set /a nmCurPart+=1
__echo !nmCurPart!>"%stFileTemp%"
__cd.>%~n1_!nmCurPart!.txt
__)
__endlocal
__)
__echo 执行完成。
__set nmCurLine=
__set nmCurPart=
__set stTemp=
__set nmTotalnmCurLine=
__if exist "%stFileTemp%" del "%stFileTemp%" /f
__goto EOF
__
__:PERROR
__echo 输出文件数 %nmTotalPart% 错误。
__goto EOF
__
__:NOFILE
__echo 文本 '%1' 不存在。
__goto EOF
__
__:EOF
nekopack:srchstr:2074:2097
__@echo off
__if /i "%*"=="/nekolist" (echo SRCHSTR 字符串搜索工具
__goto EOF)
__echo 查找字符串
__echo Coded by neko, 2010. All rights reserved.
__echo.
__
__if "%1"=="" (
__echo 在当前目录的所有文件中搜索字符串。
__echo 所带参数即为待查找字符串。
__goto EOF)
__
__for /f %%i in ('dir /a:-d /b') do (
__setlocal enabledelayedexpansion
__>nul findstr /c:"%*" %%i
__if !errorlevel! EQU 0 (
__echo 包含字符串的文件:"%%i"
__)
__endlocal
__)
__echo 查找结束。
__goto EOF
__
__:EOF
nekopack:vdir:2099:2115
__@echo off
__if /i "%*"=="/nekolist" (echo VDIR 文件夹判断程序
__goto EOF)
__for /f "delims=" %%i in ('cd') do set stCurPath=%%i
__if "%1"=="" goto NOSYNX
__if not exist "%1" (echo '%1' 不存在
__goto EOF)
__cd "%1">nul 2>nul
__if %errorlevel% EQU 0 (echo %1 是文件夹&cd /d "%stCurPath%") else (echo %1 是文件)
__goto EOF
__
__:NOSYNX
__echo 命令格式:%0 [path]
__goto EOF
__
__:EOF
__set stCurPath=
nekopack:x:2117:2123
__@echo off
__if /i "%*"=="/nekolist" (echo X 执行命令并退出命令行
__goto EOF)
__call %*
__exit
__goto EOF
__:EOF
::data_ends
:eof
> neko酱的日记

> 我来回应