Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- title Project EasyTech
- rem Autor: JWLLEWELYN
- rem Description: Script manages the creation of packages for PDQ Deploy, the downloads of programs for Windows, manages the updates of the programs.
- rem It allows to automate the installation of offline programs.
- set "params=%*"
- cd /d "%~dp0" && ( if exist "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs" ) && fsutil dirty query %systemdrive% 1>nul 2>nul || ( echo Set UAC = CreateObject^("Shell.Application"^) : UAC.ShellExecute "cmd.exe", "/k cd ""%~sdp0"" && %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs" && "%temp%\getadmin.vbs" && exit /B )
- rem ######################### General adjustments #################################
- set "InternetTest=www.google.com"
- set "DNSTest=8.8.8.8"
- rem ###############################################################################
- rem ########################### Directory mapping #################################
- set "DirectoryDownloads=%~dp0\Downloads"
- set "DirectoryBinary=%~dp0\bin"
- set "DirectoryCatalog=%~dp0\Catalog"
- set "DirectoryPackages=%~dp0\Packages"
- set "DirectoryModules=%~dp0\Modules"
- rem ###############################################################################
- rem ##################### Set Plugins Architecture ################################
- if /I "%PROCESSOR_ARCHITECTURE%" EQU "AMD64" (goto plugins64) else (goto plugins32)
- :plugins32
- set "wget=%DirectoryBinary%\wget-win32\wget.exe"
- goto Requirements
- :plugins64
- set "wget=%DirectoryBinary%\wget-win64\wget.exe"
- goto Requirements
- rem ###############################################################################
- rem ####################### Requirements assignment ###############################
- :Requirements
- set "wgetUrl64=https://eternallybored.org/misc/wget/releases/wget-1.20.3-win64.zip"
- set "wgetUrl32=https://eternallybored.org/misc/wget/releases/wget-1.20.3-win32.zip"
- set "wgetFile64=wget-1.20.3-win64.zip"
- set "wgetFile32=wget-1.20.3-win32.zip"
- goto CheckOS
- rem ###############################################################################
- rem ############################### Check OS ######################################
- :CheckOS
- setlocal
- for /f "tokens=2 delims=[]" %%i in ('ver') do set VERSION=%%i
- for /f "tokens=2-3 delims=. " %%i in ("%VERSION%") do set VERSION=%%i.%%j
- if %VERSION% == 10.0 (
- goto CheckConnection
- )else (
- goto OSmsg
- )
- rem ###############################################################################
- rem ########################### Check Connection ##################################
- :CheckConnection
- endlocal
- ping -n 1 %InternetTest%|find "bytes=" >nul
- IF NOT ERRORLEVEL 1 goto CheckPlugins
- IF ERRORLEVEL 1 goto CheckConnection2
- :CheckConnection2
- ping -n 3 %InternetTest%|find "bytes=" >nul
- IF NOT ERRORLEVEL 1 goto CheckPlugins
- IF ERRORLEVEL 1 goto CheckConnection3
- :CheckConnection3
- ping -n 1 %DNSTest%|find "bytes=" >nul
- IF NOT ERRORLEVEL 1 goto CheckPlugins
- IF ERRORLEVEL 1 goto NoConnectionMsg
- rem ###############################################################################
- rem ########################### Check Plugins #####################################
- :CheckPlugins
- if exist %wget% (
- goto CatalogDownload
- ) else (
- goto RequirementsDownload
- )
- rem ###############################################################################
- rem ######################### Requirements Download ###############################
- :RequirementsDownload
- cls
- echo Requirements Download...
- echo 0%
- mkdir "%DirectoryDownloads%" nul
- mkdir "%DirectoryBinary%" >nul
- powershell Invoke-WebRequest -Uri "%wgetUrl64%" -OutFile "%~dp0\%DirectoryDownloads%\%wgetFile64%"
- powershell Expand-Archive -Path "%DirectoryDownloads%\%wgetFile64%" -DestinationPath "%DirectoryBinary%\wget-win64"
- echo 50%
- powershell Invoke-WebRequest -Uri "%wgetUrl32%" -OutFile "%DirectoryDownloads%\%wgetFile32%"
- echo 75%
- powershell Expand-Archive -Path "%DirectoryDownloads%\%wgetFile32%" -DestinationPath "%DirectoryBinary%\wget-win32"
- echo 100%
- rem ###############################################################################
- :CatalogDownload
- echo We are under construction...
- pause >nul
- exit
- rem ############################# Requirement Messages ############################
- :OSmsg
- cls
- echo ==============================================================================
- echo Your computer's operating system is not supported.
- echo Requires Microsoft Windows 10 Operating System.
- echo ==============================================================================
- endlocal
- echo Press any key to exit...
- pause>nul
- exit
- :NoConnectionMsg
- cls
- echo ==============================================================================
- echo Your computer has no Internet connection.
- echo Please check your internet connection.
- echo ==============================================================================
- echo Press any key to exit...
- pause>nul
- exit
- rem ###############################################################################
- exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement