@echo off
call :%* 2>nul || goto choice
goto :eof
:Sub1
rem 移动到父目录
if not defined str set "str=%~nx1"
if not exist "..\%~nx1" (move "%str%" "..\%~nx1" && set "str=" && goto :eof)
call :Sub1 "%~n1_New%~x1"
goto :eof
:Sub2
rem 脱壳
pushd "%~1"
for /f "delims=" %%i in ('dir /a /b') do call :Sub1 "%%~dpnxi"
popd
rd "%~1"
goto :eof
:choice
set /p dd=安装A,卸载X,退出T:
if "%dd%"=="a" goto setup
if "%dd%"=="A" goto setup
if "%dd%"=="x" goto unistall
if "%dd%"=="X" goto unistall
if "%dd%"=="t" goto :eof
if "%dd%"=="T" (goto :eof) else echo 重新输入 &goto choice
goto :eof
:setup
reg add "hkcr\AllFilesystemObjects\shell\移至父目录\command" /f /t reg_sz /v "" /d "\"%~0\" Sub1 \"%%1\""
reg add "hkcr\directory\shell\脱壳\command" /f /t reg_sz /v "" /d "\"%~0\" Sub2 \"%%1\""
goto :eof
:unistall
reg delete "hkcr\directory\shell\脱壳" /f
reg delete "hkcr\AllFilesystemObjects\shell\移至父目录" /f
goto :eof
这回把卸载也加进去了,还在dir 中加入了/a参数
我到现在也不知道本文中call 的用法,还有%1是如何在注册表和批处理中传递的