WizardKit/Data Transfers/KVRT.cmd
Alan Mason 6fc04266d4 2017-11: Retroactive Updates
## MAJOR refactoring done ##

* All .cmd Command scripts
  * Brandind / Settings variables now set via .bin/Scripts/settings/main.py
  * Window titles now set using KIT_FULL_NAME

* All .py Python scripts
  * All ClientDir paths should now use KIT_SHORT_NAME
  * Long lines wrapped to better follow PEP8
  * String formatting now more consistant
  * Updated run_program() and popen_program() calls to use lists
    * (e.g. cmd = ['', '', '']; run_program(cmd))
    ** Should improve clarity IMO
  * Update window titles AFTER init_global_vars() so KIT_FULL_NAME can be used

* Branding / Settings
  * Support tech now configurable
    * (e.g. "Please let {tech} know and they'll look into it")
  * Timezone now configurable
  * Upload info can now be disabled/enabled in .bin/Scripts/settings/main.py

* CHKDSK
  * Combined read-only and fix scripts and added menu

* DISM
  * Combined ScanHealth and RestoreHealth scripts and added menu

* functions/common.py
  * BREAKING: run_program() and popen_program() no longer accept 'args' variable

* Misc
  * Removed Win7 NVMe launcher
    * Never used and Win7 is deprecated
  * Removed "DeviceRemover" and "Display Driver Uninstaller" launchers
    * Both cut too deep and were not useful
  * Removed Nirsoft utilities and Sysinternals Suite launchers
    * Too many tools unused.
    * Added .url links to the websites in case the tools are needed
  * Replaced WinDirStat with TreeSizeFree
  * Replaced Q-Dir launcher with XYplorer launcher
    * Q-Dir was running into issues on Windows 10
  * Removed C.IntRep, ESET, and MBAM launchers from "OSR & VR"
  * Removed JRT
    * Deprecated and discontinued by MBAM
  * Removed unsupported QuickBooks launchers (2014 and older)
  * Removed unsupported Office launchers (2010 and 2013\365)
  * Removed "Revo Uninstaller" launcher
  * Removed infrequently used tools from "Diagnostics"
    * Auslogics DiskDefrag
    * BatteryInfoView
    * BIOSCodes
    * GpuTest
    * HeavyLoad

* Bugfixes
  * major_exception() try-blocks should catch CTL+c again
    * Allows for manual script bailing
2017-11-17 01:02:24 -07:00

129 lines
No EOL
3.4 KiB
Batchfile

:: Wizard Kit: Launcher Script ::
::
:: This script works by setting env variables and then calling Launch.cmd
:: which inherits the variables. This bypasses batch file argument parsing
:: which is awful.
@echo off
:Init
setlocal EnableDelayedExpansion
title Wizard Kit: Launcher
call :CheckFlags %*
call :FindBin
call :SetTitle Launcher
call "%bin%\Scripts\init_client_dir.cmd" /Quarantine
set "q_dir=%client_dir%\Quarantine\KVRT"
mkdir "%q_dir%">nul 2>&1
:DefineLaunch
:: Set L_TYPE to one of these options:
:: Console, Folder, Office, Program, PSScript, or PyScript
:: Set L_PATH to the path to the program folder
:: NOTE: Launch.cmd will test for L_PATH in the following order:
:: 1: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH)
:: 2: %bin%\L_PATH
:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path)
:: Set L_ITEM to one of the following:
:: 1. The filename of the item to launch
:: 2. The Office product to install
:: 3. '.' to open extracted folder
:: Set L_ARGS to include any necessary arguments (if any)
:: Set L_7ZIP to include any necessary arguments for extraction
:: Set L_CHCK to True to have Launch.cmd to stay open if an error is encountered
:: Set L_ELEV to True to launch with elevated permissions
:: Set L_NCMD to True to stay in the native console window
:: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted
set L_TYPE=Program
set L_PATH=KVRT
set L_ITEM=KVRT.exe
set L_ARGS=-accepteula -d %q_dir% -processlevel 3 -dontcryptsupportinfo -fixednames
set L_7ZIP=
set L_CHCK=True
set L_ELEV=
set L_NCMD=True
set L_WAIT=
:::::::::::::::::::::::::::::::::::::::::::
:: Do not edit anything below this line! ::
:::::::::::::::::::::::::::::::::::::::::::
:LaunchPrep
rem Verifies the environment before launching item
if not defined bin (goto ErrorNoBin)
if not exist "%bin%\Scripts\Launch.cmd" (goto ErrorLaunchCMDMissing)
:Launch
rem Calls the Launch.cmd script using the variables defined above
call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD
goto Exit
:: Functions ::
:CheckFlags
rem Loops through all arguments to check for accepted flags
set DEBUG=
for %%f in (%*) do (
if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG")
)
@exit /b 0
:FindBin
rem Checks the current directory and all parents for the ".bin" folder
rem NOTE: Has not been tested for UNC paths
set bin=
pushd "%~dp0"
:FindBinInner
if exist ".bin" (goto FindBinDone)
if "%~d0\" == "%cd%" (popd & @exit /b 1)
cd ..
goto FindBinInner
:FindBinDone
set "bin=%cd%\.bin"
set "cbin=%cd%\.cbin"
popd
@exit /b 0
:SetTitle
rem Sets title using KIT_NAME_FULL from settings\main.py
set "SETTINGS=%bin%\Scripts\settings\main.py"
for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_FULL %SETTINGS%`) do (
set "_v=%%f"
set "_v=!_v:*'=!"
set "KIT_NAME_FULL=!_v:~0,-1!"
)
set "window_title=%*"
if not defined window_title set "window_title=Launcher"
set "window_title=%KIT_NAME_FULL%: %window_title%"
title %window_title%
@exit /b 0
:: Errors ::
:ErrorLaunchCMD
echo.
echo ERROR: Launch.cmd did not run correctly. Try using the /DEBUG flag?
goto Abort
:ErrorLaunchCMDMissing
echo.
echo ERROR: Launch.cmd script not found.
goto Abort
:ErrorNoBin
echo.
echo ERROR: ".bin" folder not found.
goto Abort
:Abort
color 4e
echo Aborted.
echo.
echo Press any key to exit...
pause>nul
color
rem Set errorlevel to 1 by calling color incorrectly
color 00
goto Exit
:: Cleanup and exit ::
:Exit
endlocal
exit /b %errorlevel%