Code:
@echo off
cls
color f0
call :progress 0
REM ---------------------------------------------------------------------------------------------------------------------------------
:CHECKINGRIGHTS
call :isAdmin
if %errorlevel% == 0 (
goto :gotAdmin
) else (
echo.
echo.
echo Requesting Elevated Privilages...
echo.
echo.
echo ษออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออป
echo บ บ
echo บ You must click "Yes" on the "User Account Control" pop-up. บ
echo บ บ
echo ศออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออผ
goto :UACPrompt
)
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
exit /B
:gotAdmin
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
pushd "%CD%"
CD /D "%~dp0"
goto :START
:isAdmin
fsutil dirty query %systemdrive% >nul
exit /b
REM ---------------------------------------------------------------------------------------------------------------------------------
:START
Echo.
Echo.
Echo ษออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออป
Echo บ บ
Echo บ Welcome to the Configurations and Settings Application! บ
Echo บ บ
Echo ศออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออผ
Echo.
Echo.
REM ---------------------------------------------------------------------------------------------------------------------------------
:SETUPLOGS
if exist "c:\Install Logs" goto :STEP1
md "c:\Install Logs"
REM ---------------------------------------------------------------------------------------------------------------------------------
:STEP1
if exist "C:\Install Logs\1.log" goto :DONE1
echo set WshShell = WScript.CreateObject("WScript.Shell") > %tmp%\tmp1.vbs
echo WScript.Quit (WshShell.Popup( "Step 1" + CHR(13) + CHR(13) + "Would you like to do your task?" + CHR(13), , "Step 1 - Your Task", 4 + 32)) >> %tmp%\tmp1.vbs
cscript /nologo %tmp%\tmp1.vbs
if %errorlevel%==6 (
REM ***ENTER YOUR COMMAND FOR STEP 1 HERE***
cls
for /F "usebackq tokens=1,2 delims==" %%i in (`wmic os get LocalDateTime /VALUE 2^>NUL`) do if '.%%i.'=='.LocalDateTime.' set ldt=%%j
set ldt=%ldt:~0,4%-%ldt:~4,2%-%ldt:~6,2% %ldt:~8,2%:%ldt:~10,2%:%ldt:~12,6%
echo Local Administrator Set Active [%ldt%] >> "C:\Install Logs\1.log"
for /F "usebackq tokens=1,2 delims==" %%i in (`wmic os get LocalDateTime /VALUE 2^>NUL`) do if '.%%i.'=='.LocalDateTime.' set ldt=%%j
set ldt=%ldt:~0,4%-%ldt:~4,2%-%ldt:~6,2% %ldt:~8,2%:%ldt:~10,2%:%ldt:~12,6%
echo Local Administrator Set Active [%ldt%] >> "C:\Install Logs\ReBoot.Needed.log"
) else (
if %errorlevel%==7 (
goto :DONE1
) else (
goto :ERROR
)
)
del %tmp%\tmp1.vbs
echo.
echo Step 1 - Complete
msg %username% /w Your Task was completed.
:DONE1
call :progress 33
REM ---------------------------------------------------------------------------------------------------------------------------------
:STEP2
if exist "C:\Install Logs\2.log" goto :DONE2
echo set WshShell = WScript.CreateObject("WScript.Shell") > %tmp%\tmp2.vbs
echo WScript.Quit (WshShell.Popup( "Step 2" + CHR(13) + CHR(13) + "Would you like to do your task?" + CHR(13), , "Step 2 - Your Task", 4 + 32)) >> %tmp%\tmp2.vbs
cscript /nologo %tmp%\tmp2.vbs
if %errorlevel%==6 (
REM ***ENTER YOUR COMMAND FOR STEP 2 HERE***
cls
for /F "usebackq tokens=1,2 delims==" %%i in (`wmic os get LocalDateTime /VALUE 2^>NUL`) do if '.%%i.'=='.LocalDateTime.' set ldt=%%j
set ldt=%ldt:~0,4%-%ldt:~4,2%-%ldt:~6,2% %ldt:~8,2%:%ldt:~10,2%:%ldt:~12,6%
echo Remote Desktop Access Enabled [%ldt%] >> "C:\Install Logs\2.log"
) else (
if %errorlevel%==7 (
goto :DONE2
) else (
goto :ERROR
)
)
del %tmp%\tmp2.vbs
echo.
echo Step 1 - Complete
echo Step 2 - Complete
msg %username% /w Your Task was completed.
:DONE2
call :progress 66
REM ---------------------------------------------------------------------------------------------------------------------------------
:TEMPMAPDRIVE
if exist "C:\Install Logs\ReBoot.Needed.log" goto :REBOOTNEEDED
echo.
echo.
rem net use x: /delete /yes
net use x: \\SERVERNAME\FOLDERNAME /user:DOMAIN\Administrator
cls
echo.
echo Step 1 - Complete
echo Step 2 - Complete
REM ---------------------------------------------------------------------------------------------------------------------------------
:STEP3
if exist "C:\Install Logs\3.log" goto :DONE3
echo set WshShell = WScript.CreateObject("WScript.Shell") > %tmp%\tmp3.vbs
echo WScript.Quit (WshShell.Popup( "Step 3" + CHR(13) + CHR(13) + "Would you like to install your app?" + CHR(13), , "Step 3 - Install Your Application", 4 + 32)) >> %tmp%\tmp3.vbs
cscript /nologo %tmp%\tmp3.vbs
if %errorlevel%==6 (
if exist "C:\Program Files (x86)\APPLICATION" goto :LOG3
"x:\APPLICATION\Setup.exe"
) else (
if %errorlevel%==7 (
goto :DONE3
) else (
goto :ERROR
)
)
:LOG3
del %tmp%\tmp3.vbs
if not exist "C:\Program Files (x86)\McAfee" goto :DONE3
for /F "usebackq tokens=1,2 delims==" %%i in (`wmic os get LocalDateTime /VALUE 2^>NUL`) do if '.%%i.'=='.LocalDateTime.' set ldt=%%j
set ldt=%ldt:~0,4%-%ldt:~4,2%-%ldt:~6,2% %ldt:~8,2%:%ldt:~10,2%:%ldt:~12,6%
echo McAfee installation verified [%ldt%] >> "C:\Install Logs\3.log"
:DONE3
call :progress 99
echo Step 3 - Complete
REM ---------------------------------------------------------------------------------------------------------------------------------
:REMOVETEMPDRIVE
net use x: /delete /yes
cls
echo.
echo Step 1 - Complete
echo Step 2 - Complete
echo Step 3 - Complete
REM ---------------------------------------------------------------------------------------------------------------------------------
:END
call :progress 100
if "%~f0" == "%userprofile%\AppData\Roaming\MICROS~1\Windows\STARTM~1\Programs\Startup\%~nx0" ( goto :CLEANUP )
msg %username% /w All steps have completed.
Exit
:CLEANUP
msg %username% /w All steps have completed.
call :deleteSelf&exit /b
:deleteSelf
start /b "" cmd /c del "%~f0"&exit /b
Exit
REM ---------------------------------------------------------------------------------------------------------------------------------
:REBOOTNEEDED
if exist "%userprofile%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\%~nx0" goto :COPYDONE
copy "%~f0" "%userprofile%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\%~nx0"
cls
:COPYDONE
cls
color 4F
Echo.
Echo.
Echo ษออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออป
Echo บ บ
Echo บ YOU MUST REBOOT THE COMPUTER AND RERUN THIS บ
Echo บ บ
Echo บ BATCH FILE! YOUR PROGRESS HAS BEEN SAVED บ
Echo บ บ
Echo บ PRESS ANY KEY TO RESTART THE COMPUTER NOW! บ
Echo บ บ
Echo ศออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออผ
Echo.
Echo.
Pause
del "C:\Install Logs\ReBoot.Needed.log"
shutdown -t 0 -r -f
Exit
REM ---------------------------------------------------------------------------------------------------------------------------------
:ERROR
if exist "%tmp%\tmp1.vbs" ( del "%tmp%\tmp1.vbs" )
if exist "%tmp%\tmp2.vbs" ( del "%tmp%\tmp2.vbs" )
if exist "%tmp%\tmp3.vbs" ( del "%tmp%\tmp3.vbs" )
cls
echo.
echo An unexpected error has occured. Please contact your administrator.
msg %username% /w An error has occured. Please contact your administrator for further assistance.
if "%~f0" == "%userprofile%\AppData\Roaming\MICROS~1\Windows\STARTM~1\Programs\Startup\%~nx0" ( goto :CLEANUP )
Exit
REM ---------------------------------------------------------------------------------------------------------------------------------
:progress
SETLOCAL ENABLEDELAYEDEXPANSION
SET ProgressPercent=%1
SET /A NumBars=%ProgressPercent%/2
SET /A NumSpaces=50-%NumBars%
SET Meter=
FOR /L %%A IN (%NumBars%,-1,1) DO SET Meter=!Meter!I
FOR /L %%A IN (%NumSpaces%,-1,1) DO SET Meter=!Meter!
TITLE Progress: [%Meter%] %ProgressPercent%%%
ENDLOCAL