0% found this document useful (0 votes)
23 views4 pages

Admin Rights Batch Script Guide

This script runs with elevated admin privileges to install and launch various programs. It first checks the user's privileges and launches an elevated command prompt if needed using a VBScript. It then displays a menu where the user can choose to install/launch: 1) Antivirus software, 2) Activate Windows 10, 3) TJMG court browser, 4) PJE Office software, 5) Cisco Webex, or 6) Court media software. For each option, it checks if the software is already installed and either launches the existing install or downloads and runs a new installer.

Uploaded by

BrunoTomaz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views4 pages

Admin Rights Batch Script Guide

This script runs with elevated admin privileges to install and launch various programs. It first checks the user's privileges and launches an elevated command prompt if needed using a VBScript. It then displays a menu where the user can choose to install/launch: 1) Antivirus software, 2) Activate Windows 10, 3) TJMG court browser, 4) PJE Office software, 5) Cisco Webex, or 6) Court media software. For each option, it checks if the software is already installed and either launches the existing install or downloads and runs a new installer.

Uploaded by

BrunoTomaz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

::::::::::::::::::::::::::::::::::::::::::::

:: Elevate.cmd - Version 4
:: Automatically check & get admin rights
:: see "https://stackoverflow.com/a/12264592/1016343" for description
::::::::::::::::::::::::::::::::::::::::::::
@echo off
CLS
ECHO.
ECHO =============================
ECHO Running Admin shell
ECHO =============================

:init
setlocal DisableDelayedExpansion
set cmdInvoke=1
set winSysFolder=System32
set "batchPath=%~dpnx0"
rem this works also from cmd shell, other than %~0
for %%k in (%0) do set batchName=%%~nk
set "%SystemRoot%\System32\WScript.exe" "%temp%\OEgetPrivileges.vbs"
setlocal EnableDelayedExpansion

:checkPrivileges
NET FILE 1>NUL 2>NUL
if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges )

:getPrivileges
if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges)
ECHO.
ECHO **************************************
ECHO Invoking UAC for Privilege Escalation
ECHO **************************************

ECHO Set UAC = CreateObject^("Shell.Application"^) > "%vbsGetPrivileges%"


ECHO args = "ELEV " >> "%vbsGetPrivileges%"
ECHO For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%"
ECHO args = args ^& strArg ^& " " >> "%vbsGetPrivileges%"
ECHO Next >> "%vbsGetPrivileges%"

if '%cmdInvoke%'=='1' goto InvokeCmd

ECHO UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%"


goto ExecElevation

:InvokeCmd
ECHO args = "/c """ + "!batchPath!" + """ " + args >> "%vbsGetPrivileges%"
ECHO UAC.ShellExecute "%SystemRoot%\%winSysFolder%\cmd.exe", args, "", "runas", 1
>> "%vbsGetPrivileges%"

:ExecElevation
"%SystemRoot%\%winSysFolder%\WScript.exe" "%vbsGetPrivileges%" %*
exit /B

:gotPrivileges
setlocal & cd /d %~dp0
if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul & shift /1)

::::::::::::::::::::::::::::
::START
::::::::::::::::::::::::::::
REM Run shell as admin (example) - put here code as you like
@echo off
cls
:menu
cls
color 71
echo Usuario Logado:%username% Computador:%computername%
date /t

echo __________________________
echo ESCOLHA UMA OPCAO.
ECHO.
ECHO. 1- ANTIVIRUS
ECHO. 2- ATIVAR_WINDOWS10
ECHO. 3- NAVEGADOR_PJE_TJMG
ECHO. 4- PJEOFFICE
ECHO. 5- CISCO WEBEX
ECHO. 6- MIDIAS_1.2.0
echo __________________________

set /p opcao= Escolha uma opcao:


echo.............
if %opcao% equ 1 goto ANTIVIRUS
if %opcao% equ 2 goto ATIVAR_WINDOWS10
if %opcao% equ 3 goto NAVEGADOR_PJE_TJMG
if %opcao% equ 4 goto PJEOFFICE
if %opcao% equ 5 goto CISCO WEBEX
if %opcao% equ 6 goto MIDIAS_1.2.0
if %opcao equ 7 goto opcao7

:ANTIVIRUS
cls
if exist Symantec_x64.exe /v/qb(
pause
) else (
ECHO. COPIE O SETUP DO ANTIVIRUS E COLE EM KIT INSTALACAO
pause
ECHO. C:\KIT INSTALACAO\Symantec_x64.exe
cls
Symantec_x64.exe
echo. Abra o gerenciador de Tarefas para verificar a instalacao.
echo. Quando terminar a instalacao :
pause
goto menu
)

:ATIVAR_WINDOWS10
cls
echo. C:\KITINSTALACAO\SCRIPTS\ATIVAR_WINDOWS10.EXE" (
ATIVAR_WINDOWS10.EXE
cls
pause
goto menu
)

:NAVEGADOR_PJE_TJMG
if exist "C:\NavegadorPJe_TJMG\Firefox\FirefoxPortable.exe" (
start C:\NavegadorPJe_TJMG\Firefox\FirefoxPortable.exe
pause
goto menu
) else (
bitsadmin /transfer instalador NAVEGADORPJE /priority normal C:\SCRIPT\TJMG\
NAVEGADOR_PJE_TJMG.exe C:\Users\%username%\Downloads\NAVEGADOR_PJE_TJMG.exe
pause
start C:\Users\%username%\Downloads\NAVEGADOR_PJE_TJMG.exe
pause
start C:\Users\%username%\Downloads\NAVEGADOR_PJE_TJMG.exe
pause
goto menu
)
:PJEOFFICE
cls
if exist ""C:\Program Files (x86)\pje-office\PJeOffice.exe" (
start pjeOffice.exe
pause
goto menu
) else (
ECHO. COPIE O PJE E COLE EM KIT INSTALACAO
pause
ECHO. C:\KIT INSTALACAO\pjeOffice.exe
start C:\KIT INSTALACAO\pjeOffice.exe
pause
start pjeOffice.exe
pause
goto menu
)

:CISCO WEBEX
cls
if exist "C:\Program Files (x86)\Webex\Webex\Applications\ptoneclk.exe" (
start ptoneclk.exe
pause
goto menu
) else (
ECHO. COPIE O PJE E COLE NA AREA DE TRABALHO
pause
ECHO. C:\Users\field162\Desktop\Webex_x.msi.exe
start C:\Users\field162\Desktop\Webex_x.msi.exe
pause
start Webex_x.msi.exe
pause
goto menu
)

:MIDIAS_1.2.0
cls
if exist "C:\Arquivos de Programas CNJ\AD\1.2.0\ad-1.2.0.jar" (
start ad-1.2.0.jar
pause
goto menu
) else (
ECHO. COPIE O AUDIENCIA DIGITAL E COLE EM KIT INSTALACAO
pause
ECHO. C:\Users\field162\Desktop\ad-1.2.0.jar
start C:\Users\field162\Desktop\ad-1.2.0.jar
pause
start ad-1.2.0.jar
pause
goto menu
)

:op7
exit

You might also like