36 lines
892 B
Batchfile
36 lines
892 B
Batchfile
@echo off
|
|
|
|
:: 检查是否以管理员权限运行
|
|
net session >nul 2>&1
|
|
if %errorLevel% == 0 (
|
|
goto :installCert
|
|
) else (
|
|
echo Acquiring administrator privileges...
|
|
goto :getAdmin
|
|
)
|
|
|
|
:getAdmin
|
|
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
|
|
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
|
|
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
|
|
"%temp%\getadmin.vbs"
|
|
exit /B
|
|
|
|
:installCert
|
|
echo Installing root certificate.....
|
|
set ec=0
|
|
pushd "%~dp0"
|
|
for %%f in (Certificate/*.crt) do (
|
|
certutil -addstore -f "ROOT" Certificate/%%f
|
|
set /a ec+=%errorlevel%
|
|
)
|
|
popd
|
|
echo ===============================
|
|
if %ec%==0 (
|
|
color 0a
|
|
echo Successful.
|
|
) else (
|
|
color 0c
|
|
echo There may be issues during the installation process.
|
|
)
|
|
pause
|