权限问题- @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=TOOLS1112222"
- REM main foldername
- set "linkFolderName=C:\ProgramData"
- 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 set "link=%linkFolderName%\%exeFolderName%\%%exe:%folder%\=%%"
- call mkdir "%%link:%%~nxi=%%" >nul 2>nul
- call mklink "%%link:~0,-4%%" "%%~i" >nul
- )
- pause&exit
复制代码
|