批处理之家大师的went的代码如下:
@echo off
REM Admin
%1 start "" mshta vbscript:createobject("shell.application").shellexecute("""%~0""","REM",,"runas",1)(window.close)&exit
REM search drivers
set "drivers=C D E F G H I J K L M N O P Q R S T U V W X Y Z"
REM exe foldername
set "exeFolderName=集群工具包"
REM main foldername
set "linkFolderName1=%USERPROFILE%\desktop"
set "linkFolderName2=%ProgramData%\Microsoft\Windows\Start Menu\Programs"
REM esp exe
set "espExe=\磁盘软件\BOOTICE.exe?\图片工具\小型截图软件.exe?\镜像软件\UltraISO.exe?\播放器\PotPlayer.exe?\数据恢复\数据恢复.exe"
REM start
for %%i in (%drivers%) do if exist "%%i:\" (
set /p="check:%%i:\%exeFolderName% "<nul
if exist "%%i:\%exeFolderName%" (
echo OK!
set "folder=%%i:\%exeFolderName%"
goto :done
) else echo not found!
)
echo -------------
for %%i in (%drivers%) do (
cd /d "%%i:\" 2>nul && (
echo search %%i: please wait...
for /r /d %%a in ("*") do (
if "%%~na" equ "%exeFolderName%" (
set "folder=%%~a"
goto :done
)
)
)
)
:done
if "%folder%"=="" echo %exeFolderName% not found! & pause&exit
echo -------------
echo "folder=%folder%"
echo -------------
for /r "%folder%" %%i in ("*.exe") do (
echo mklink: %%~i
call set "exe=%%~i"
call echo %espExe% | call findstr /i /C:"%%exe:%folder%\=%%" >nul 2>nul && (
call echo add %userprofile%\desktop
mklink "%userprofile%\desktop\%%~ni" "%%~i" >nul
)
for /f "tokens=2 delims==" %%a in ('set linkFolderName') do (
call set "link=%%a\%exeFolderName%\%%exe:%folder%\=%%"
call mkdir "%%link:%%~nxi=%%" >nul 2>nul
call mklink "%%link:~0,-4%%" "%%~i" >nul
)
)