- 积分
- 1605
- 最后登录
- 2024-4-26
- 精华
- 0
- 阅读权限
- 50
- 主题
- 24
- UID
- 667580
- 帖子
- 968
- PB币
- 4836
- 威望
- 203
- 贡献
- 0
- 技术
- 15
- 活跃
- 3218
- UID
- 667580
- 帖子
- 968
- PB币
- 4836
- 贡献
- 0
- 技术
- 15
- 活跃
- 3218
|
整合一下x86和x64- @echo off
- setlocal EnableExtensions EnableDelayedExpansion
- :--------------------------------------------------------------------------
- openfiles >nul 2>&1
- if %errorlevel% NEQ 0 goto :UACPrompt
- goto :gotAdmin
- :UACPrompt
- echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
- echo UAC.ShellExecute "%~fs0 %*", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
- "%temp%\getadmin.vbs"
- del "%temp%\getadmin.vbs"
- exit /b
- :gotAdmin
- pushd "%~dp0"
- :--------------------------------------------------------------------------
- cd utils
- ver|find "6." >nul 2>&1 || (
- echo.ERROR: Must running Windows Vista or later OS.
- pause
- exit /B
- )
- for /f "tokens=4 delims= " %%a in ('tasklist /fi "SESSIONNAME eq Console" /fo table /nh') do (
- set id=%%a
- )
- if not defined id (
- echo.ERROR: Cannot gather session ID.
- pause
- exit /B
- )
- tasklist|find "TrustedInstaller.exe" >nul 2>&1 || (
- net start TrustedInstaller
- )
- if "%1"=="" (
- if exist "%SystemRoot%\sysWOW64\cmd.exe" (
- start /b RunAsSystem64.exe "RunFromToken64.exe TrustedInstaller.exe !id! cmd.exe"
- ) else (
- start /b RunAsSystem.exe "RunFromToken.exe TrustedInstaller.exe !id! cmd.exe"
- )
- ) else (
- if exist "%SystemRoot%\sysWOW64\cmd.exe" (
- start /b RunAsSystem64.exe "RunFromToken64.exe TrustedInstaller.exe !id! "%*""
- ) else (
- start /b RunAsSystem.exe "RunFromToken.exe TrustedInstaller.exe !id! "%*""
- )
- )
- exit /B
复制代码 |
|