WizardKit/Data Transfers/Q-Dir (as ADMIN).cmd
Alan Mason 7616f2ea5f 2016-11: Retroactive Updates
* NEW: CompressedBin folder .cbin
  * This folder holds compressed versions of what was in .bin
    * These files are 7-zip compressed using file + header encryption
    * (This is to avoid false-positive AV alerts)

* NEW: Python conversion
  * All scripts rewritten / ported to Python
  * All PoSH scripts removed
  * All scripts adjusted to no longer use vars as a variable
    * This is because vars is a built-in function
    * Also, slightly more clear as vars_wk == variables for Wizard Kit
  * vars_os merged with vars_wk for since both are based on the current system
  * Launch.cmd no longer uses %path% and instead directly modifies L_PATH
    * fixes bug where an empty %PATH% would halt various scripts

* Copy WizardKit
  * Now only copies the required folders in .bin
    * Avoids potentially massive slowdowns on often-used UFDs
  * Updated to support the new .cbin folder

* User Data Transfer expanded
  * File-based main data selection is now done first
  * Default inclusions and exclusions adjusted
  * Cleanup should now unhide TransferDir

* Launch.cmd and Launchers updated
  * Launch and Launcher_Template reworked to support the new .cbin method
    * Launch will extract the archive (if exists) and then launch the item
  * Launch.cmd now automatically reloads inside ConEmu
  * Launch.cmd now runs from L_ITEM's dir in most cases
  * Added L_NCMD to use the native command window instead of ConEmu
  * Added PywScript mode that uses Python native console window
  * Launchers are customized at the top of the files now
    * FindBin and Flags functions have been moved to the end of the file
  * Launchers and Launch.cmd now use more descriptive variable names
    * Helps readability and troubleshooting
  * Ported code from copy_office.cmd into Launch.cmd
    * Office setup local folders now have better naming
  * Scripts should now print details about the ENV when aborting
    * Should help diagnose future breaks, typos, etc..
  * Added a gen_office.bash script for creating the Office Setup Launchers
  * Fixed Office variable issue (needed delayedexpansion)

* SW Diagnostics / SW Checklist
  * (Re)added Kill All Processes section using ProcessKiller 2.0 from Tron
  * Added Everything - dumps a file listing of the %systemdrive%
  * Added Opera to the browser backup section
  * AdwCleaner is no longer removed during the checklist
  * HWiNFO has replaced HWMonitor due to false AMD/ATI readings
  * HWiNFO is not opened until after Enter is pressed to exit the checklist
  * Installed OS warnings expanded to mark many more versions as outdated
  * SAS is no longer force-removed at the end of the script
  * The new user data size function is reading data for all users
2017-11-17 00:54:34 -07:00

111 lines
No EOL
2.8 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
title Wizard Kit: Launcher
call :CheckFlags %*
call :FindBin
: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=Q-Dir
set L_ITEM=Q-Dir.exe
set L_ARGS="%userprofile%"
set L_7ZIP=
set L_CHCK=True
set L_ELEV=True
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
:: 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%