WizardKit/Drivers/Samsung NVMe Driver.cmd
Alan Mason b37a492db5 2017-03: Retroactive Updates
## MAJOR refactoring in progress ##

# BROKEN SCRIPTS #
  (These scripts need updated to use the new global_vars & try_and_print)
    * user_data_transfer.py
    * install_sw_bundle.py

* All Python scripts
  * PLAN: Replace vars_wk with global_vars

* functions.py
  * PLAN: Will hold (nearly?) all functions going forward
    * Should simplify the remaining scripts
    * (e.g. reset_browsers and sw_diagnostics both had a backup_browsers())
  * PLAN: Move all program definitions to functions.py
    * (e.g. vars_wk['SevenZip'] --> global_vars['Programs']['SevenZip'])
  * Added major_exception()
    * Should be called if anything goes wrong to alert user and provide info
  * Added non_clobber_rename()
    * Appends a number (if necessary) to avoid overwriting data
  * Added popen_program()
    * Removes subprocess req for sw_checklist
  * Added try_and_print()
    * Run a function and show CS/NS/etc
    * Can add additional "result" strings via Exception classes
    * Passes unrecognized args/kwargs to the function
    * Used by scripts to standardize message formatting and error handling
  * exit_script() now handles opening the log (if set) and killing caffeine.exe
  * Refactored init_vars_wk/os code to work with global_vars
    * Uses the try_and_print function for better formatting and error handling
    * BREAKING: 'OS' vars now located in global_vars['OS'] (including 'Arch')
      * OS labeled as 'outdated', 'very outdated', and 'unrecognized' as needed
    * BREAKING: renamed PROGRAMS to TOOLS
      * Expanded TOOLS
  * Removed log_file as a required argument from all functions
  * Removed vars_wk/global_vars as a required argument from all functions
  * Removed unused WinPE functions
  * Sorted functions

* user_checklist() (formerly reset_browsers())
  * Most functions moved to functions.py (see above)
  * Browsers
    * Work has been split into backup, reset, and config sections
    * Script now asks all questions before starting backup/reset/config
    * Script now forces the homepage to DEFAULT_HOMEPAGE (set in functions.py)
      * (i.e. it no longer asks first, it just does it)
    * Current homepages are listed where possible before backup/reset/config

* Launch/Launchers
  * Added QuickBooks support

* Removed launchers
  * CPU-Z
  * HWMonitor
  * PerfMonitor2
  * SanDisk Express Cache
  * Shortcut Cleaner
  * SuperAntiSpyware (SAS)

* Replaced Notepad2-Mod with Notepad++
2017-11-17 00:56:16 -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=_Drivers
set L_ITEM=Samsung NVMe Driver.exe
set L_ARGS=
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
:: 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%