diff --git a/.bin/Scripts/Get-FolderSize.ps1 b/.bin/Scripts/Get-FolderSize.ps1 deleted file mode 100644 index 85848a9e..00000000 --- a/.bin/Scripts/Get-FolderSize.ps1 +++ /dev/null @@ -1,75 +0,0 @@ -#requires -version 2 -[CmdletBinding()] -param( - # Paths to report size, file count, dir count, etc. for. - [Parameter(Mandatory=$true,ValueFromPipeline=$true)] [string[]] $Path -) - -# Copyright (c) 2015, Svendsen Tech -# All rights reserved. -# Author: Joakim Svendsen - -begin { - if (-not (Get-Command -Name robocopy -ErrorAction SilentlyContinue)) { - throw "I need robocopy. Exiting." - } -} -# PS C:\temp> [datetime]::ParseExact("Mon Jan 26 00:05:19 2015", 'ddd MMM dd HH:mm:ss yyyy', [Globalization.CultureInfo]::InvariantCulture) - -# Attempt to change language to en-US for robocopy's output to be in english... -#$OldCulture = [System.Threading.Thread]::CurrentThread.CurrentCulture - -process { - foreach ($p in $Path) { - Write-Verbose -Message "Processing path: $p. $(Get-Date)" - if (-not (Test-Path -Path $p -PathType Container)) { - Write-Warning -Message "$p does not exist or is a file and not a directory. Skipping." - continue - } - $RoboCopyArgs = @("/L","/S","/NJH","/BYTES","/FP","/NC","/NDL","/TS","/XJ","/R:0","/W:0") - [datetime] $StartedTime = Get-Date - #[System.Threading.Thread]::CurrentThread.CurrentCulture = 'en-US' - [string] $Summary = robocopy $p NULL $RoboCopyArgs | Select-Object -Last 8 - #[System.Threading.Thread]::CurrentThread.CurrentCulture = $OldCulture - [regex] $HeaderRegex = '\s+Total\s+Copied\s+Skipped\s+Mismatch\s+FAILED\s+Extras' - [regex] $DirLineRegex = 'Dirs\s:\s+(?\d+)(?:\s+\d+){3}\s+(?\d+)\s+\d+' - [regex] $FileLineRegex = 'Files\s:\s+(?\d+)(?:\s+\d+){3}\s+(?\d+)\s+\d+' - [regex] $BytesLineRegex = 'Bytes\s:\s+(?\d+)(?:\s+\d+){3}\s+(?\d+)\s+\d+' - [regex] $TimeLineRegex = 'Times\s:\s+(?\d+).*' - [regex] $EndedLineRegex = 'Ended\s:\s+(?.+)' - if ($Summary -match "$HeaderRegex\s+$DirLineRegex\s+$FileLineRegex\s+$BytesLineRegex\s+$TimeLineRegex\s+$EndedLineRegex") { - $ErrorActionPreference = 'Stop' - try { - $EndedTime = [datetime]::ParseExact($Matches['EndedTime'], 'ddd MMM dd HH:mm:ss yyyy', [Globalization.CultureInfo]::InvariantCulture) - } - catch { - try { - $EndedTime = [datetime] $Matches['EndedTime'] - } - catch { - $EndedTime = $Matches['EndedTime'] + ' (string)' - } - } - $ErrorActionPreference = 'Continue' - New-Object PSObject -Property @{ - Path = $p - TotalBytes = [int64] $Matches['ByteCount'] - TotalMBytes = [math]::Round(([int64] $Matches['ByteCount'] / 1MB), 4) - TotalGBytes = [math]::Round(([int64] $Matches['ByteCount'] / 1GB), 4) - BytesFailed = [int64] $Matches['ByteFailed'] - DirCount = [int64] $Matches['DirCount'] - FileCount = [int64] $Matches['FileCount'] - DirFailed = [int64] $Matches['DirFailed'] - FileFailed = [int64] $Matches['FileFailed'] - StartedTime = $StartedTime - EndedTime = $EndedTime - - } | Select Path, TotalBytes, TotalMBytes, TotalGBytes, DirCount, FileCount, DirFailed, FileFailed, StartedTime, EndedTime - } - else { - Write-Warning -Message "$p's output from robocopy was not in an expected format." - } - } -} - -#[System.Threading.Thread]::CurrentThread.CurrentCulture = $OldCulture diff --git a/.bin/Scripts/Launch.cmd b/.bin/Scripts/Launch.cmd index c154a5c3..d178a26f 100644 --- a/.bin/Scripts/Launch.cmd +++ b/.bin/Scripts/Launch.cmd @@ -6,140 +6,371 @@ :: * Allows for smaller "launcher" scripts to be used as they will rely on this script. @echo off +if defined DEBUG (@echo on) :Init setlocal EnableDelayedExpansion title Wizard Kit: Launcher - -:Flags -set admin= -set max= -set wait= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) - if /i "%%f" == "/admin" (set admin=true) - if /i "%%f" == "/max" (set max=true) - if /i "%%f" == "/wait" (set wait=true) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +pushd "%~dp0" +call :FindBin +call :DeQuote L_ITEM +call :DeQuote L_PATH +call :DeQuote L_TYPE :SetVariables -if /i "!PROCESSOR_ARCHITECTURE!" == "AMD64" set "arch=64" -set "con=%bin%\ConEmu\ConEmu.exe" -set "python=%bin%\Python\x32\python.exe" -if !arch! equ 64 ( - set "con=%bin%\ConEmu\ConEmu64.exe" - set "python=%bin%\Python\x64\python.exe" +set "ARCHIVE_PASS=Abracadabra" +set "OFFICE_SERVER=10.0.0.10" +rem Set ARCH to 32 as a gross assumption and check for x86_64 status +set ARCH=32 +if /i "%PROCESSOR_ARCHITECTURE%" == "AMD64" set "ARCH=64" +set "SEVEN_ZIP=%bin%\7-Zip\7za.exe" +set "CON=%bin%\ConEmu\ConEmu.exe" +set "FASTCOPY=%bin%\FastCopy\FastCopy.exe" +set "PYTHON=%bin%\Python\x32\python.exe" +if %ARCH% equ 64 ( + set "SEVEN_ZIP=%bin%\7-Zip\7za64.exe" + set "CON=%bin%\ConEmu\ConEmu64.exe" + set "FASTCOPY=%bin%\FastCopy\FastCopy64.exe" + set "PYTHON=%bin%\Python\x64\python.exe" ) -:Launch -pushd "%2" -if /i "%1" == "Console" (goto LaunchConsole) -if /i "%1" == "Office" (goto LaunchOfficeSetup) -if /i "%1" == "Program" (goto LaunchProgram) -if /i "%1" == "PSScript" (goto LaunchPSScript) -if /i "%1" == "PyScript" (goto LaunchPyScript) +:CheckUsage +rem Check for empty passed variables +if not defined L_TYPE (goto Usage) +if not defined L_PATH (goto Usage) +if not defined L_ITEM (goto Usage) +rem Assume if not "True" then False (i.e. undefine variable) +if /i not "%L_CHCK%" == "True" (set "L_CHCK=") +if /i not "%L_ELEV%" == "True" (set "L_ELEV=") +if /i not "%L_NCMD%" == "True" (set "L_NCMD=") +if /i not "%L_WAIT%" == "True" (set "L_WAIT=") + +:RelaunchInConEmu +if not defined IN_CONEMU ( + if not defined L_NCMD ( + set "con_args=-new_console:n" + rem If in DEBUG state then force ConEmu to stay open + if defined DEBUG (set "con_args=!con_args! -new_console:c") + set IN_CONEMU=True + start "" "%CON%" -run ""%~0" %*" !con_args! || goto ErrorUnknown + exit /b 0 + ) +) + +:CheckLaunchType +rem Jump to the selected launch type or show usage +if /i "%L_TYPE%" == "Console" (goto LaunchConsole) +if /i "%L_TYPE%" == "Folder" (goto LaunchFolder) +if /i "%L_TYPE%" == "Office" (goto LaunchOfficeSetup) +if /i "%L_TYPE%" == "Program" (goto LaunchProgram) +if /i "%L_TYPE%" == "PSScript" (goto LaunchPSScript) +if /i "%L_TYPE%" == "PyScript" (goto LaunchPyScript) +if /i "%L_TYPE%" == "PywScript" (goto LaunchPywScript) goto Usage :LaunchConsole -set "prog=%~3" -if !arch! equ 64 ( - if exist "!prog:.=64.!" set "prog=!prog:.=64.!" +rem Check for a 64-bit version and set args +set "con_args=-new_console:n" +if defined DEBUG (set "con_args=%con_args% -new_console:c") +if defined L_ELEV (set "con_args=%con_args% -new_console:a") +rem Test L_PATH and set %_path% +call :TestPath || goto ErrorProgramNotFound +rem Check for 64-bit prog (if running on 64-bit system) +set "prog=%_path%\%L_ITEM%" +if %ARCH% equ 64 ( + if exist "%_path%\%L_ITEM:.=64.%" set "prog=%_path%\%L_ITEM:.=64.%" ) -if not exist "!prog!" goto ProgramNotFound -if defined admin ( - start "" "%con%" -cmd "!prog!" %~4 -new_console:a -new_console:n -) else ( - start "" "%con%" -cmd "!prog!" %~4 -new_console:n -) -goto Done +if not exist "%prog%" goto ErrorProgramNotFound +popd && pushd "%_path%" +rem Run program in console emulator %CON% and catch error(s) +start "" "%CON%" -run "%prog%" %L_ARGS% %con_args% || goto ErrorUnknown +goto Exit + +:LaunchFolder +rem Test L_PATH and set %_path% (extracts archive in necessary) +call :TestPath || goto ErrorProgramNotFound +start "" "explorer.exe" "%_path%" || goto ErrorUnknown +goto Exit :LaunchOfficeSetup -set "prog=%~3" -start "" "%con%" -cmd call "%bin%\copy_office.cmd" "!prog!" -new_console:n -goto Done +rem set args and copy setup files to system +rem NOTE: init_client_dir.cmd sets %client_dir% and creates %SystemDrive%\WK\Office folder +call "%bin%\Scripts\init_client_dir.cmd" /Office +echo Copying setup file(s) for %L_ITEM%... +rem NOTE: If L_PATH == "2013" or "2016" extract the ODT setup/xml, otherwise copy from OFFICE_SERVER +set "_odt=False" +if %L_PATH% equ 2013 (set "_odt=True") +if %L_PATH% equ 2016 (set "_odt=True") +if "%_odt%" == "True" ( + rem extract setup/xml and start installation + set "source=%L_PATH%\setup.exe" + set "dest=%client_dir%\Office\%L_PATH%" + "%SEVEN_ZIP%" e "%cbin%\_Office.7z" -aoa -bso0 -bse0 -p%ARCHIVE_PASS% -o"!dest!" !source! !L_ITEM! || exit /b 1 + "%systemroot%\System32\ping.exe" -n 2 127.0.0.1>nul + if not exist "!dest!\setup.exe" (goto ErrorOfficeSourceNotFound) + if not exist "!dest!\!L_ITEM!" (goto ErrorOfficeSourceNotFound) + pushd "!dest!" + rem # The line below jumps to ErrorUnknown even though setup.exe is run correctly?? + rem start "" "setup.exe" /configure !L_ITEM! || popd & goto ErrorUnknown + rem # Going to assume it extracted correctly and blindly start setup.exe + start "" "setup.exe" /configure !L_ITEM! + popd +) else ( + rem copy setup files from OFFICE_SERVER + set "fastcopy_args=/cmd=diff /no_ui /auto_close" + set "product=%L_PATH%\%L_ITEM%" + set "product_name=%L_ITEM%" + call :GetBasename product_name || goto ErrorBasename + set "source=\\%OFFICE_SERVER%\Office\!product!" + set "dest=%client_dir%\Office" + rem Verify source + if not exist "!source!" (goto ErrorOfficeSourceNotFound) + rem Copy setup file(s) to system + start "" /wait "%FASTCOPY%" !fastcopy_args! "!source!" /to="!dest!\" + rem Run setup + if exist "!dest!\!product_name!\setup.exe" ( + start "" "!dest!\!product_name!\setup.exe" || goto ErrorUnknown + ) else if "!product_name:~-3,3!" == "exe" ( + start "" "!dest!\!product_name!" || goto ErrorUnknown + ) else if "!product_name:~-3,3!" == "msi" ( + start "" "!dest!\!product_name!" || goto ErrorUnknown + ) else ( + rem Office source not supported by this script + goto ErrorOfficeUnsupported + ) +) +goto Exit :LaunchProgram -set "prog=%~3" -if !arch! equ 64 ( - if exist "!prog:.=64.!" set "prog=!prog:.=64.!" +rem Test L_PATH and set %_path% +call :TestPath || goto ErrorProgramNotFound +rem Check for 64-bit prog (if running on 64-bit system) +set "prog=%_path%\%L_ITEM%" +if %ARCH% equ 64 ( + if exist "%_path%\%L_ITEM:.=64.%" set "prog=%_path%\%L_ITEM:.=64.%" ) -if not exist "!prog!" goto ProgramNotFound -if not "%~4" == "" (set "vb_args=%~4") -if defined admin ( - mkdir "%bin%\tmp" +if not exist "%prog%" goto ErrorProgramNotFound +popd && pushd "%_path%" +rem Run program and catch error(s) +if defined L_ELEV ( + call :DeQuote prog + call :DeQuote L_ARGS + rem Create a temporary VB script to elevate the specified program + mkdir "%bin%\tmp" 2>nul echo Set UAC = CreateObject^("Shell.Application"^) > "%bin%\tmp\Elevate.vbs" - echo UAC.ShellExecute "!prog!", "!vb_args!", "", "runas", 1 >> "%bin%\tmp\Elevate.vbs" - cscript //nologo "%bin%\tmp\Elevate.vbs" + echo UAC.ShellExecute "!prog!", "!L_ARGS!", "", "runas", 1 >> "%bin%\tmp\Elevate.vbs" + "%systemroot%\System32\cscript.exe" //nologo "%bin%\tmp\Elevate.vbs" || goto ErrorUnknown ) else ( - if defined max (set "max=/max") - if defined wait (set "wait=/wait") - start "" !max! !wait! "!prog!" %~4 + if defined L_WAIT (set "wait=/wait") + start "" %wait% "%prog%" %L_ARGS% || goto ErrorUnknown ) -goto Done +goto Exit :LaunchPSScript -set "script=%~3" -if not exist "!script!" goto ScriptNotFound -if defined wait (set "wait=-Wait") -if defined admin ( - start "" "%con%" -run PowerShell -ExecutionPolicy Bypass -File "!script!" -NoProfile -new_console:a !wait! -) else ( - start "" "%con%" -run PowerShell -ExecutionPolicy Bypass -File "!script!" -NoProfile !wait! -) -goto Done +rem Test L_PATH and set %_path% +rem NOTE: This should always result in path=%bin%\Scripts. Exceptions are unsupported. +call :TestPath || goto ErrorProgramNotFound +rem Set args +set "script=%_path%\%L_ITEM%" +set "ps_args=-ExecutionPolicy Bypass -File "%script%" -NoProfile" +if defined L_ELEV (set "ps_args=%ps_args% -new_console:a -new_console:n") +if defined L_WAIT (set "ps_args=%ps_args% -Wait") +if not exist "%script%" goto ErrorScriptNotFound +rem Run program and catch error(s) +start "" "%CON%" -run %systemroot%\system32\WindowsPowerShell\v1.0\powershell.exe %ps_args% || goto ErrorUnknown +goto Exit :LaunchPyScript -set "script=%~3" -if not exist "!script!" goto ScriptNotFound -if defined admin ( - start "" "%con%" -run "%python%" "!script!" -new_console:a -new_console:n +rem Test L_PATH and set %_path% +rem NOTE: This should always result in path=%bin%\Scripts. Exceptions are unsupported. +call :TestPath || goto ErrorProgramNotFound +rem Set args +set "script=%_path%\%L_ITEM%" +set "py_args=-new_console:n" +if not exist "%script%" goto ErrorScriptNotFound +if defined L_ELEV ( + call :DeQuote script + rem Create a temporary VB script to elevate the specified program + mkdir "%bin%\tmp" 2>nul + echo Set UAC = CreateObject^("Shell.Application"^) > "%bin%\tmp\Elevate.vbs" + echo UAC.ShellExecute "%CON%", "-run %PYTHON% !script! %py_args%", "", "runas", 1 >> "%bin%\tmp\Elevate.vbs" + "%systemroot%\System32\cscript.exe" //nologo "%bin%\tmp\Elevate.vbs" || goto ErrorUnknown ) else ( - start "" "%con%" -run "%python%" "!script!" -new_console:n + start "" "%CON%" -run "%PYTHON%" "%script%" %py_args% || goto ErrorUnknown ) -goto Done +goto Exit + +:LaunchPywScript +rem Test L_PATH and set %_path% +rem NOTE: This should always result in path=%bin%\Scripts. Exceptions are unsupported. +call :TestPath || goto ErrorProgramNotFound +rem Set args +set "script=%_path%\%L_ITEM%" +if not exist "%script%" goto ErrorScriptNotFound +if defined L_ELEV ( + call :DeQuote script + rem Create a temporary VB script to elevate the specified program + mkdir "%bin%\tmp" 2>nul + echo Set UAC = CreateObject^("Shell.Application"^) > "%bin%\tmp\Elevate.vbs" + echo UAC.ShellExecute "%PYTHON%", "!script!", "", "runas", 3 >> "%bin%\tmp\Elevate.vbs" + "%systemroot%\System32\cscript.exe" //nologo "%bin%\tmp\Elevate.vbs" || goto ErrorUnknown +) else ( + start "" "%PYTHON%" "%script%" /max || goto ErrorUnknown +) +goto Exit :Usage echo. -echo.Usage: Launch.cmd Console "Working Dir" "Program" "Args" [/admin] -echo. Launch.cmd Office "Working Dir" "Product" "" -echo. Launch.cmd Program "Working Dir" "Program" "Args" [/admin] [/max] [/wait] -echo. Launch.cmd PSScript "Working Dir" "Program" "" [/admin] [/wait] -echo. Launch.cmd PyScript "Working Dir" "Program" "" [/admin] -echo. (Args should be empty when using PSScript or PyScript) +echo.Usage (via defined variables): +echo. L_TYPE L_PATH L_ITEM L_ARGS +echo. Console Working Dir Program Args [L_CHECK] [L_ELEV] [L_NCMD] [L_WAIT] +echo. Folder Folder '.' [L_CHECK] [L_NCMD] +echo. Office Year Product [L_CHECK] [L_NCMD] +echo. Program Working Dir Program Args [L_CHECK] [L_ELEV] [L_NCMD] [L_WAIT] +echo. PSScript Scripts Script [L_CHECK] [L_ELEV] [L_NCMD] +echo. PyScript Scripts Script [L_CHECK] [L_ELEV] [L_NCMD] +echo. PywScript Scripts Script [L_CHECK] [L_ELEV] [L_NCMD] +echo. +echo. NOTE: PywScript uses Python's window instead of %CON% echo. goto Abort -:ProgramNotFound +:: Functions :: +:DeQuote +rem Code taken from http://ss64.com/nt/syntax-dequote.html +if not defined %1 (@exit /b 1) +for /f "delims=" %%a in ('echo %%%1%%') do set %1=%%~a +@exit /b 0 + +:ExtractCBin +rem Extract %cbin% archive into %bin% +echo Extracting "%L_ITEM%"... +if exist "%cbin%\%L_PATH%\%L_ITEM:~0,-4%.7z" ( + "%SEVEN_ZIP%" x "%cbin%\%L_PATH%\%L_ITEM:~0,-4%.7z" -aos -bso0 -bse0 -p%ARCHIVE_PASS% -o"%bin%\%L_PATH%" %L_7ZIP% || exit /b 1 +) else ( + "%SEVEN_ZIP%" x "%cbin%\%L_PATH%.7z" -aos -bso0 -bse0 -p%ARCHIVE_PASS% -o"%bin%\%L_PATH%" %L_7ZIP% || exit /b 1 +) +ping.exe -n 2 127.0.0.1>nul +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 + +:GetBasename +rem Loop over passed variable to remove all text left of the last '\' character +rem NOTE: This function should be called as 'call :GetBasename VarName || goto ErrorBasename' to catch variables that become empty. +for /f "delims=" %%a in ('echo %%%1%%') do (set "_tmp=%%~a") +:GetBasenameInner +set "_tmp=%_tmp:*\=%" +if not defined _tmp (@exit /b 1) +if not "%_tmp%" == "%_tmp:*\=%" (goto GetBasenameInner) +:GetBasenameDone +set "%1=%_tmp%" +@exit /b 0 + +:TestPath +rem Test L_PATH in the following order: +rem 1: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) +rem 2: %bin%\L_PATH +rem 3. %L_PATH% (i.e. treat L_PATH as an absolute path) +rem NOTE: This function should be called as 'call :TestPath || goto ErrorProgramNotFound' to catch invalid paths. +set _path= +if exist "%cbin%\%L_PATH%.7z" ( + call :ExtractCBin +) else if exist "%cbin%\%L_PATH%\%L_ITEM:~0,-4%.7z" ( + call :ExtractCBin +) +if exist "%bin%\%L_PATH%" (set "_path=%bin%\%L_PATH%") +if not defined _path (set "_path=%L_PATH%") +rem Raise error if path is still not available +if not exist "%_path%" (exit /b 1) +exit /b 0 + +:: Errors :: +:ErrorBasename echo. -echo Program not found. +echo ERROR: GetBasename resulted in an empty variable. goto Abort -:ScriptNotFound +:ErrorNoBin echo. -echo Script not found. +echo ERROR: ".bin" folder not found. +goto Abort + +:ErrorOfficeSourceNotFound +echo. +echo ERROR: Office source "%L_ITEM%" not found. +goto Abort + +:ErrorOfficeUnsupported +rem Source is not an executable nor is a folder with a setup.exe file inside. Open explorer to local setup file(s) instead. +echo. +echo ERROR: Office version not supported by this script. +start "" "explorer.exe" "%client_dir%\Office" +goto Abort + +:ErrorProgramNotFound +echo. +echo ERROR: Program "%prog%" not found. +goto Abort + +:ErrorScriptNotFound +echo. +echo ERROR: Script "%script%" not found. +goto Abort + +:ErrorUnknown +echo. +echo ERROR: Unknown error encountered. goto Abort :Abort -color 4e -echo. +rem Handle color theme for both the native console and ConEmu +if defined L_NCMD ( + color 4e +) else ( + color c4 +) echo Aborted. echo. -echo Press any key to exit... -pause>nul -goto Exit - -:Done +echo DETAILS: L_TYPE: %L_TYPE% +echo. L_PATH: %L_PATH% +echo. L_ITEM: %L_ITEM% +echo. L_ARGS: %L_ARGS% +echo. L_CHCK: %L_CHCK% +echo. L_ELEV: %L_ELEV% +echo. L_NCMD: %L_NCMD% +echo. L_WAIT: %L_WAIT% +echo. CON: %CON% +echo. DEBUG: %DEBUG% +echo. PYTHON: %PYTHON% +rem Pause script only if we want to catch the error AND only when using ConEmu +if defined L_CHCK ( + if not defined L_NCMD ( + 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 popd -endlocal \ No newline at end of file +endlocal +exit /b %errorlevel% \ No newline at end of file diff --git a/.bin/Scripts/Launcher_Template.cmd b/.bin/Scripts/Launcher_Template.cmd new file mode 100644 index 00000000..03f27bb1 --- /dev/null +++ b/.bin/Scripts/Launcher_Template.cmd @@ -0,0 +1,111 @@ +:: 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=__TYPE__ +set L_PATH=__PATH__ +set L_ITEM=__ITEM__ +set L_ARGS= +set L_7ZIP= +set L_CHCK=True +set L_ELEV= +set L_NCMD= +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% \ No newline at end of file diff --git a/.bin/Scripts/_Update Kit.cmd b/.bin/Scripts/_Update Kit.cmd new file mode 100644 index 00000000..812ae960 --- /dev/null +++ b/.bin/Scripts/_Update Kit.cmd @@ -0,0 +1,111 @@ +:: 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=PyScript +set L_PATH=Script +set L_ITEM=update_kit.py +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% \ No newline at end of file diff --git a/.bin/Scripts/activate.py b/.bin/Scripts/activate.py index 61e36e04..30988acb 100644 --- a/.bin/Scripts/activate.py +++ b/.bin/Scripts/activate.py @@ -9,58 +9,46 @@ import subprocess os.chdir(os.path.dirname(os.path.realpath(__file__))) os.system('title Wizard Kit: Windows Activation Tool') from functions import * -vars = init_vars() -vars_os = init_vars_os() -vars['ProduKey'] = '{BinDir}\\tmp\\ProduKey.exe'.format(**vars) -vars['SevenZip'] = '{BinDir}\\7-Zip\\7za.exe'.format(**vars) -if vars_os['Arch'] == 64: - vars['SevenZip'] = vars['SevenZip'].replace('7za.exe', '7za64.exe') - vars['ProduKey'] = vars['ProduKey'].replace('ProduKey.exe', 'ProduKey64.exe') +vars_wk = init_vars_wk() +vars_wk.update(init_vars_os()) +vars_wk['ProduKey'] = '{BinDir}\\ProduKey\\ProduKey.exe'.format(**vars_wk) +vars_wk['SevenZip'] = '{BinDir}\\7-Zip\\7za.exe'.format(**vars_wk) +if vars_wk['Arch'] == 64: + vars_wk['SevenZip'] = vars_wk['SevenZip'].replace('7za.exe', '7za64.exe') + vars_wk['ProduKey'] = vars_wk['ProduKey'].replace('ProduKey.exe', 'ProduKey64.exe') def abort(): print_warning('Aborted.') exit_script() -def exit_script(): - pause("Press Enter to exit...") - quit() - -def extract_produkey(): - """Extract ProduKey and remove stale configuration file(s).""" - lolwut = run_program(vars['SevenZip'], ['e', '{BinDir}\\ProduKey.7z'.format(**vars), '-o{TmpDir}'.format(**vars), '-pAbracadabra', '-aoa', '-bsp0', '-bso0'], check=False) - _cwd = os.getcwd() - os.chdir('{TmpDir}'.format(**vars)) - for _f in ['ProduKey.cfg', 'ProduKey64.cfg']: - try: - os.remove(_f) - except FileNotFoundError: - pass - os.chdir(_cwd) - def activate_with_bios(): """Attempt to activate Windows with a key stored in the BIOS.""" - extract_produkey() + extract_item('ProduKey', vars_wk, silent=True) _args = [ '/nosavereg', - '/scomma', '{TmpDir}\\keys.csv'.format(**vars), + '/scomma', '{TmpDir}\\keys.csv'.format(**vars_wk), '/WindowsKeys', '1', '/OfficeKeys', '0', '/IEKeys', '0', '/SQLKeys', '0', '/ExchangeKeys', '0'] try: - run_program(vars['ProduKey'], _args, pipe=False) - with open ('{TmpDir}\\keys.csv'.format(**vars), newline='') as key_file: + run_program(vars_wk['ProduKey'], _args, pipe=False) + except subprocess.CalledProcessError: + print_error('ERROR: Failed to extract BIOS key') + abort() + else: + with open ('{TmpDir}\\keys.csv'.format(**vars_wk), newline='') as key_file: key_reader = csv.reader(key_file) _key_found = False for key in key_reader: if 'BIOS' in key[0] and re.match(r'^\w{5}-\w{5}-\w{5}-\w{5}-\w{5}$', key[2]): _key_found = True print_standard('BIOS key found, installing...') - run_program('cscript {WINDIR}\\System32\\slmgr.vbs /ipk {pkey} //nologo'.format(**vars['Env'], pkey=key[2]), check=False, shell=True) + run_program('cscript {SYSTEMROOT}\\System32\\slmgr.vbs /ipk {pkey} //nologo'.format(**vars_wk['Env'], pkey=key[2]), check=False, shell=True) sleep(15) print_standard('Attempting activation...') - run_program('cscript {WINDIR}\\System32\\slmgr.vbs /ato //nologo'.format(**vars['Env']), check=False, shell=True) + run_program('cscript {SYSTEMROOT}\\System32\\slmgr.vbs /ato //nologo'.format(**vars_wk['Env']), check=False, shell=True) sleep(15) # Open system properties for user verification subprocess.Popen(['control', 'system']) @@ -68,32 +56,44 @@ def activate_with_bios(): if not _key_found: print_error('ERROR: BIOS not key found.') abort() - except subprocess.CalledProcessError: - print_error('ERROR: Failed to extract BIOS key') - abort() def activate_with_hive(): """Scan any transferred software hives for Windows keys and attempt activation.""" - # extract_produkey() - pass + extract_item('ProduKey', vars_wk, silent=True) + +def exit_script(): + pause("Press Enter to exit...") + quit() + +def is_activated(): + """Updates activation status, checks if activated, and returns a bool.""" + _out = run_program('cscript /nologo {SYSTEMROOT}\\System32\\slmgr.vbs /xpr'.format(**vars_wk['Env'])) + _out = _out.stdout.decode().splitlines() + _out = [l for l in _out if re.match(r'^\s', l)] + if len(_out) > 0: + vars_wk['Activation'] = re.sub(r'^\s+', '', _out[0]) + else: + vars_wk['Activation'] = 'Activation status unknown' + return 'The machine is permanently activated.' in vars_wk['Activation'] if __name__ == '__main__': + stay_awake(vars_wk) # Bail early if already activated - if 'The machine is permanently activated.' in vars_os['Activation']: + if is_activated(): print_info('This system is already activated') - # exit_script() + exit_script() # Determine activation method activation_methods = [ {'Name': 'Activate with BIOS key', 'Function': activate_with_bios}, {'Name': 'Activate with transferred SW hive', 'Function': activate_with_hive, 'Disabled': True}, ] - if not re.match(r'^(8|10)$', vars_os['Version']): + if not re.match(r'^(8|10)$', vars_wk['Version']): activation_methods[0]['Disabled'] = True actions = [ {'Name': 'Quit', 'Letter': 'Q'}, ] - + # Main loop while True: selection = menu_select('Wizard Kit: Windows Activation Menu', activation_methods, actions) @@ -106,4 +106,5 @@ if __name__ == '__main__': # Quit print_success('Done.') + kill_process('caffeine.exe') exit_script() \ No newline at end of file diff --git a/.bin/Scripts/check_battery.ps1 b/.bin/Scripts/check_battery.ps1 deleted file mode 100644 index ab2ddac1..00000000 --- a/.bin/Scripts/check_battery.ps1 +++ /dev/null @@ -1,31 +0,0 @@ -# Wizard Kit: List battery health by checking the current max charge against the original value - -param([string]$log = "Battery.log") -if ($log -match '^Battery.log$') { - $log = "{0}\Battery.log" -f (gci env:temp).value -} - -pushd $(Split-Path $MyInvocation.MyCommand.Path) -. .\init.ps1 - -try { - $designed_full = (get-wmiobject -class "BatteryStaticData" -namespace "ROOT\WMI").DesignedCapacity 2>out-null - $last_full = (get-wmiobject -class "BatteryFullChargedCapacity" -namespace "ROOT\WMI").FullChargedCapacity 2>out-null - $last_percentage = ($last_full / $designed_full) * 100 - $message = " Last full charge was {0:N0}% of designed capacity" -f $last_percentage - - if ($last_percentage -eq 100) { - WK-warn " Unable to determine battery health" "$log" - } elseif ($last_percentage -ge 90) { - WK-write $message "$log" - } elseif ($last_percentage -ge 50) { - WK-warn $message "$log" - } else { - WK-error $message "$log" - } -} catch { - WK-warn " No battery detected" "$log" -} - -## Done ## -popd diff --git a/.bin/Scripts/check_disk.cmd b/.bin/Scripts/check_disk.cmd deleted file mode 100644 index 0e898dda..00000000 --- a/.bin/Scripts/check_disk.cmd +++ /dev/null @@ -1,23 +0,0 @@ -@echo off - -:Flags -set fix= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) - if /i "%%f" == "/f" (set fix=/f) -) - -:Init -title Wizard Kit: CheckDisk -color 1b - -:ScheduleCheck -chkdsk %fix% %systemdrive% -if defined fix ( - echo Press any key to reboot... - pause>nul - shutdown -r -t 10 -) else ( - echo Press any ket to exit... - pause>nul -) \ No newline at end of file diff --git a/.bin/Scripts/check_disk.ps1 b/.bin/Scripts/check_disk.ps1 deleted file mode 100644 index 3fda3c04..00000000 --- a/.bin/Scripts/check_disk.ps1 +++ /dev/null @@ -1,23 +0,0 @@ -# Wizard Kit: Check Disk - -## Init ## -$wd = $(Split-Path $MyInvocation.MyCommand.Path) -pushd "$wd" -. .\init.ps1 -clear -$host.UI.RawUI.WindowTitle = "Wizard Kit: Check Disk Tool" - -# OS Check -. .\check_os.ps1 - -## Run Scan (read-only) ## -write-host "$systemdrive (System Drive)" -if ($win_version -match '^(8|10)$') { - start -wait "chkdsk" -argumentlist @("$systemdrive", "/scan", "/perf") -nonewwindow -} else { - start -wait "chkdsk" -argumentlist @("$systemdrive") -nonewwindow -} - -## Done ## -popd -pause "Press Enter to exit..." diff --git a/.bin/Scripts/check_disk.py b/.bin/Scripts/check_disk.py new file mode 100644 index 00000000..9b461945 --- /dev/null +++ b/.bin/Scripts/check_disk.py @@ -0,0 +1,37 @@ +# Wizard Kit: Check Disk Tool + +import os +import subprocess + +# Init +os.chdir(os.path.dirname(os.path.realpath(__file__))) +os.system('title Wizard Kit: Check Disk Tool') +from functions import * +vars_wk = init_vars_wk() +vars_wk.update(init_vars_os()) + +def abort(): + print_warning('Aborted.', vars_wk['LogFile']) + exit_script() + +def exit_script(): + pause("Press Enter to exit...") + quit() + +if __name__ == '__main__': + stay_awake(vars_wk) + print_info('* Running CHKDSK (read-only) on {SYSTEMDRIVE}'.format(**vars_wk['Env'])) + # Run scan (read-only) + try: + if vars_wk['Version'] in ['8', '10']: + run_program('chkdsk {SYSTEMDRIVE} /scan /pref'.format(**vars_wk['Env']), pipe=False) + else: + # Windows 7 and older + run_program('chkdsk {SYSTEMDRIVE}'.format(**vars_wk['Env']), pipe=False) + except subprocess.CalledProcessError: + print_error('ERROR: CHKDSK encountered a problem. Please review any messages above.') + abort() + + print_success('Done.') + kill_process('caffeine.exe') + exit_script() diff --git a/.bin/Scripts/check_disk_fix.ps1 b/.bin/Scripts/check_disk_fix.ps1 deleted file mode 100644 index 593e8979..00000000 --- a/.bin/Scripts/check_disk_fix.ps1 +++ /dev/null @@ -1,28 +0,0 @@ -# Wizard Kit: Check Disk - -## Init ## -$wd = $(Split-Path $MyInvocation.MyCommand.Path) -pushd "$wd" -. .\init.ps1 -clear -$host.UI.RawUI.WindowTitle = "Wizard Kit: Check Disk Tool" - -# OS Check -. .\check_os.ps1 - -## Run Scan (fix) ## -write-host "$systemdrive (System Drive)" -if ($win_version -match '^(8|10)$') { - if (ask("Run Spot-fix and security cleanup?")) { - start -wait "chkdsk" -argumentlist @("$systemdrive", "/sdcleanup", "/spotfix") -nonewwindow - } else if (ask("Run full offline scan?")) { - start -wait "chkdsk" -argumentlist @("$systemdrive", "/offlinescanandfix") -nonewwindow - } -} else { - start -wait "chkdsk" -argumentlist @("$systemdrive", "/F") -nonewwindow -} - -## Done ## -popd -pause "Press Enter to reboot..." -restart-computer diff --git a/.bin/Scripts/check_disk_fix.py b/.bin/Scripts/check_disk_fix.py new file mode 100644 index 00000000..1817dfd8 --- /dev/null +++ b/.bin/Scripts/check_disk_fix.py @@ -0,0 +1,43 @@ +# Wizard Kit: Check Disk Tool + +import os +import subprocess + +# Init +os.chdir(os.path.dirname(os.path.realpath(__file__))) +os.system('title Wizard Kit: Check Disk Tool') +from functions import * +vars_wk = init_vars_wk() +vars_wk.update(init_vars_os()) + +def abort(): + print_warning('Aborted.', vars_wk['LogFile']) + exit_script() + +def exit_script(): + pause("Press Enter to reboot...") + run_program('shutdown -r -t 3', check=False) + quit() + +if __name__ == '__main__': + stay_awake(vars_wk) + print_info('* Running CHKDSK (repairs) on {SYSTEMDRIVE}'.format(**vars_wk['Env'])) + # Run scan (and attempt to repair errors) + try: + if vars_wk['Version'] in ['8', '10']: + try: + run_program('chkdsk {SYSTEMDRIVE} /sdcleanup /spotfix'.format(**vars_wk['Env']), pipe=False) + except subprocess.CalledProcessError: + print_error('ERROR: CHKDSK is still reporting problems.') + if ask('Run full offline scan?'): + run_program('chkdsk {SYSTEMDRIVE} /offlinescanandfix'.format(**vars_wk['Env']), pipe=False) + else: + # Windows 7 and older + run_program('chkdsk {SYSTEMDRIVE} /F'.format(**vars_wk['Env']), pipe=False) + except subprocess.CalledProcessError: + print_error('ERROR: CHKDSK encountered a problem. Please review any messages above.') + abort() + + print_success('Done.') + kill_process('caffeine.exe') + exit_script() diff --git a/.bin/Scripts/check_os.ps1 b/.bin/Scripts/check_os.ps1 deleted file mode 100644 index db5707ba..00000000 --- a/.bin/Scripts/check_os.ps1 +++ /dev/null @@ -1,64 +0,0 @@ -# Wizard Kit: Set some OS specific variables. - -$win_info = gp hklm:"\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -if ($win_info.CurrentVersion -match "6.0") { - $win_version = "Vista" -} elseif ($win_info.CurrentVersion -match "6.1") { - $win_version = "7" -} elseif ($win_info.CurrentVersion -match "6.2") { - $win_version = "8" -} elseif ($win_info.CurrentVersion -match "6.3") { - if ($win_info.CurrentBuildNumber -match "9200") { - $win_version = "8" - } elseif ($win_info.CurrentBuildNumber -match "9600") { - $win_version = "8" - } elseif ($win_info.CurrentBuildNumber -ge "10240") { - $win_version = "10" - } -} -$arch = (gci env:processor_architecture).value -$arch = $arch -ireplace 'x86', '32' -$arch = $arch -ireplace 'AMD64', '64' - -#$win_info.CurrentBuild -# == vista == -# 6.0.6000 -# 6.0.6001 -# 6.0.6002 -# ==== 7 ==== -# 6.1.7600 -# 6.1.7601 -# 6.1.7602 -# ==== 8 ==== -# 6.2.9200 -# === 8.1 === -# 6.3.9200 -# === 8.1u == -# 6.3.9600 -# === 10 v1507 "Threshold 1" == -# 6.3.10240 -# === 10 v1511 "Threshold 2" == -# 6.3.10586 -# === 10 v1607 "Anniversary Update" "Redstone 1" == -# 6.3.14393 -# === 10 v____ "Redstone 2" == -# 6.3. - -$os_name = $win_info.ProductName -$os_name += " " + $win_info.CSDVersion -$os_name = $os_name -replace 'Service Pack ', 'SP' -if ($win_info.CurrentBuild -match "9600") { - $os_name += " Update" -} elseif ($win_info.CurrentBuild -match "10586") { - $os_name += " Release 1511" -} elseif ($win_info.CurrentBuild -match "14393") { - $os_name += " Release 1607 Anniversary Update" -} - -# Get activation status -if ($safemode) { - $win_act = " Activation status unavailable in safe mode" -} else { - $slmgr = (gci env:windir).value + "\System32\slmgr.vbs" - $win_act = (cscript /nologo $slmgr /xpr) -imatch '^\s' -} diff --git a/.bin/Scripts/checklist.ps1 b/.bin/Scripts/checklist.ps1 deleted file mode 100644 index f20351fd..00000000 --- a/.bin/Scripts/checklist.ps1 +++ /dev/null @@ -1,291 +0,0 @@ -# WK-Checklist - -## Init ## -$wd = $(Split-Path $MyInvocation.MyCommand.Path) -pushd "$wd" -. .\init.ps1 -clear -$host.UI.RawUI.WindowTitle = "WK Checklist Tool" -$logpath = "$WKPath\Info\$date" -md "$logpath" 2>&1 | out-null -$log = "$logpath\Checklist.log" -$bin = (Get-Item $wd).Parent.FullName -$diag_dest = "/srv/Diagnostics" -$diag_server = "10.0.0.10" -$diag_user = "wkdiag" -$sz = "$bin\7-Zip\7za.exe" -$produkey = "$bin\tmp\ProduKey.exe" - -# OS Check -. .\os_check.ps1 -if ($arch -eq 64) { - $sz = "$bin\7-Zip\7za64.exe" - $produkey = "$bin\tmp\ProduKey64.exe" -} - -# Set Service Order -while ($service_order -notmatch '^\d+') { - $service_order = read-host "Please enter the service order number" - if ($service_order -notmatch '^\d+') { - write-host "ERROR: Invalid SO`r`n" -foreground "red" - } -} -clear -out-file -filepath "$logpath\TicketNumber" -inputobject $service_order -append -wk-write "Starting final checklist for Ticket #$service_order" "$log" -wk-write "" "$log" - -## Cleanup ## -wk-write "Pre-Checklist Cleanup" "$log" - -# Uninstall AdwCleaner -if (test-path "$systemdrive\AdwCleaner") { - try { - wk-write "* Uninstalling AdwCleaner" "$log" - move-item "$systemdrive\AdwCleaner\*log" "$WKPath\Info\" - move-item "$systemdrive\AdwCleaner\*txt" "$WKPath\Info\" - if (test-path "$systemdrive\AdwCleaner\Quarantine") { - move-item "$systemdrive\AdwCleaner\Quarantine" "$WKPath\Quarantine\AdwCleaner" - } - remove-item "$systemdrive\AdwCleaner" -recurse - } catch { - wk-error " Failed to uninstall AdwCleaner; please remove manually." "$log" - } -} - -# Uninstall Autoruns -if (test-path "HKCU:\Software\Sysinternals\AutoRuns") { - wk-write "* Uninstalling Autoruns" "$log" - Remove-Item -Path HKCU:\Software\Sysinternals\AutoRuns -Recurse 2>&1 | out-null - if ((Get-ChildItem -Path HKCU:\Software\Sysinternals 2> out-null | Measure-Object).count -eq 0) { - Remove-Item -Path HKCU:\Software\Sysinternals 2>&1 | out-null - } -} - -# Move ComboFix Logs -if (test-path "$systemdrive\ComboFix") { - wk-write "* Moving ComboFix leftovers" "$log" - wk-warn " TODO" "$log" -} - -# Uninstall ESET -if (test-path "$programfiles86\ESET\ESET Online Scanner") { - wk-write "* Uninstalling ESET" "$log" - start -wait "$programfiles86\ESET\ESET Online Scanner\OnlineScannerUninstaller.exe" -argumentlist "/s" - rm -path "$programfiles86\ESET\ESET Online Scanner" -recurse 2>&1 | out-null - if ((gci -path "$programfiles86\ESET" 2> out-null | Measure-Object).count -eq 0) { - rm -path "$programfiles86\ESET" 2>&1 | out-null - } -} - -# Move JRT logs & backups -if (test-path "$userprofile\Desktop\JRT*") { - wk-write "* Cleaning up JRT leftovers" "$log" - wk-warn " TODO" "$log" -} - -# Uninstall MBAM -if (test-path "$programfiles86\Malwarebytes") { - wk-write "* Uninstalling MBAM" "$log" - wk-warn " TODO" "$log" -} - -# Move RKill logs & backups -if (test-path "$userprofile\Desktop\rkill*") { - wk-write "* Cleaning up RKill leftovers" "$log" - wk-warn " TODO" "$log" -} - -# Uninstall SUPERAntiSpyware -# It is always in programfiles (not x86) ?? -$sas_force_remove = $false -if (test-path "$programfiles\SUPERAntiSpyware") { - if (test-path "$programfiles\SUPERAntiSpyware\Uninstall.exe") { - wk-write "* Uninstalling SUPERAntiSpyware" "$log" - start -wait "$programfiles\SUPERAntiSpyware\Uninstall.exe" - } else { - wk-error "SUPERAntiSpyware install is broken." "$log" - $sas_force_remove = $true - } -} - -## Summary ## -wk-write "" "$log" -wk-write "Starting SW Checklist" "$log" -wk-write "" "$log" - -# Backup Registry -if (!(test-path "$logpath\Registry")) { - wk-write "* Backing up registry" "$log" - start -wait "$bin\Erunt\ERUNT.EXE" -argumentlist @("$logpath\Registry", "sysreg", "curuser", "otherusers", "/noprogresswindow") -workingdirectory "$bin\Erunt" -} - -# AIDA64 -if (!(test-path "$logpath\keys-aida64.txt")) { - wk-write "* Running AIDA64 (Product Keys)" "$log" - start -wait "$bin\AIDA64\aida64.exe" -argumentlist @("/R", "$logpath\keys-aida64.txt", "/CUSTOM", "$bin\AIDA64\licenses.rpf", "/TEXT", "/SILENT", "/SAFEST") -workingdirectory "$bin\AIDA64" -} - -if (!(test-path "$logpath\program_list-aida64.txt")) { - wk-write "* Running AIDA64 (SW listing)" "$log" - start -wait "$bin\AIDA64\aida64.exe" -argumentlist @("/R", "$logpath\program_list-aida64.txt", "/CUSTOM", "$bin\AIDA64\installed_programs.rpf", "/TEXT", "/SILENT", "/SAFEST") -workingdirectory "$bin\AIDA64" -} - -if (!(test-path "$logpath\aida64.htm")) { - wk-write "* Running AIDA64 (Full listing) in background" "$log" - start "$bin\AIDA64\aida64.exe" -argumentlist @("/R", "$logpath\aida64.html", "/CUSTOM", "$bin\AIDA64\full.rpf", "/HTML", "/SILENT") -workingdirectory "$bin\AIDA64" -} - -# SIV -if (!(test-path "$logpath\keys-siv.txt")) { - wk-write "* Running SIV (Product Keys)" "$log" - start -wait "$siv" -argumentlist @("-KEYS", "-LOCAL", "-UNICODE", "-SAVE=[product-ids]=$logpath\keys-siv.txt") -workingdirectory "$bin\SIV" -} - -if (!(test-path "$logpath\program_list-siv.txt")) { - wk-write "* Running SIV (SW listing)" "$log" - start -wait "$siv" -argumentlist @("-KEYS", "-LOCAL", "-UNICODE", "-SAVE=[software]=$logpath\program_list-siv.txt") -workingdirectory "$bin\SIV" -} - -if (!(test-path "$logpath\aida64.htm")) { - wk-write "* Running SIV (Full listing) in background" "$log" - start -wait "$siv" -argumentlist @("-KEYS", "-LOCAL", "-UNICODE", "-SAVE=$logpath\siv.txt") -workingdirectory "$bin\SIV" -} - -# Product Keys -## Extract -md "$bin\tmp" 2>&1 | out-null -start -wait $sz -argumentlist @("e", "$bin\ProduKey.7z", "-otmp", "-aoa", "-pAbracadabra", "-bsp0", "-bso0") -workingdirectory "$bin" -nonewwindow -rm "$bin\tmp\ProduKey*.cfg" -sleep -s 1 - -## Run -if (!(test-path "$logpath\keys-produkey.txt")) { - wk-write "* Saving Product Keys" "$log" - start -wait $produkey -argumentlist @("/nosavereg", "/stext", "$logpath\keys-produkey.txt") -workingdirectory "$bin\tmp" -} - -# User Data -wk-write "==== User Data ====" "$log" -& "$wd\user_data.ps1" "$log" -wk-write "" "$log" - -# OS Info -wk-write "==== Operating System ====" "$log" -wk-write " $os_name x$arch" "$log" -wk-write "$win_act" "$log" -if ($win_act -notmatch "permanent") {slui} -wk-write "" "$log" - -# Set Timezone and sync clock -wk-write "==== Clock ====" "$log" -start "tzutil" -argumentlist @("/s", '"Pacific Standard Time"') -nonewwindow -redirectstandardoutput out-null -stop-service -name "w32time" 2>&1 | out-null -start "w32tm" -argumentlist @("/config", "/syncfromflags:manual", '/manualpeerlist:"us.pool.ntp.org time.nist.gov time.windows.com"') -nonewwindow -redirectstandardoutput out-null -start-service -name "w32time" 2>&1 | out-null -start "w32tm" -argumentlist "/resync" -nonewwindow -redirectstandardoutput out-null -# gross assumption that tz=PST (should've been set earlier) -wk-write $(get-date -uformat " %a %Y-%m-%d %H:%m (PST/PDT)") "$log" -wk-write "" "$log" - -### DISABLED FOR NOW ### -## Reset power plans -#wk-write "==== Reset Power Plans ====" "$log" -## Export current power plans -#$pow_backup_path = "$WKPath\Backups\$date\Power Plans" -#md "$pow_backup_path" > $null 2>&1 | out-null -#$old_power_plans = @() -#foreach ($plan in (powercfg /L)) { -# if ($plan -imatch '^Power Scheme.*') { -# $guid = $plan -replace 'Power Scheme GUID:\s+([0-9a-f\-]+).*', '$1' -# $name = $plan -replace 'Power Scheme GUID:\s+[0-9a-f\-]+\s+\(([^\)]+)\).*', '$1' -# $set = ($plan -imatch '.*\*$') -# $old_power_plans += @{GUID = $guid; Name = $name; Set = $set} -# if (!(test-path "$pow_backup_path\$name.pow")) { -# powercfg /export "$pow_backup_path\$name.pow" $guid -# } -# } -#} -# -#start "powercfg.exe" -argumentlist "-restoredefaultschemes" -nonewwindow -redirectstandardoutput out-null -#wk-write " All power plans reset to defaults" "$log" -## TODO: Re-add and reset SSD plan(s) -#wk-warn " If the system has a SSD please verify the correct plan has been selected" "$log" -#wk-write "" "$log" -### DISABLED FOR NOW ### - -# Free Space -wk-write "==== Free Space ====" "$log" -& "$wd\free_space.ps1" "$log" -wk-write "" "$log" - -# RAM -wk-write "==== RAM ====" "$log" -& "$wd\installed_ram.ps1" "$log" -wk-write "" "$log" - -# Battery Check -wk-write "==== Battery Check ====" "$log" -& "$wd\check_battery.ps1" "$log" -wk-write "" "$log" - -## Launch Extra Tools ## -# HWMonitor -if ($arch -eq 64) { - $prog = "$bin\HWMonitor\HWMonitor64.exe" -} else { - $prog = "$bin\HWMonitor\HWMonitor.exe" -} -start $prog - -# XMPlay -start "$bin\..\Misc\XMPlay.cmd" - -## Upload info ## -write-host "Uploading info to NAS..." - -# Write batch -$batch = "lcd `"{0}`"`r`n" -f $WKPath -$batch += "cd `"{0}`"`r`n" -f $diag_dest -$batch += "put -r Info `"{0}`"`r`n" -f $service_order -out-file -encoding "ASCII" -filepath "$wd\psftp_batch" -inputobject $batch - -# Upload files -$psftp_args = @( - "-noagent", - "-i", "$bin\PuTTY\WK.ppk", - "$diag_user@$diag_server", - "-b", "$wd\psftp_batch") -start "$bin\PuTTY\PSFTP.exe" -argumentlist $psftp_args -wait -windowstyle minimized - -## Done ## -popd -pause "Press Enter to review drivers and updates..." - -# Launch post progs -start devmgmt.msc -if ($win_version -eq 10) { - start ms-settings:windowsupdate -} else { - start wuapp -} - -# Launch SAS Removal Tool (if necessary) -if ($sas_force_remove) { - pushd "$bin\_Removal Tools" - if ($arch -eq 64) { - $prog = "SASUNINST64.exe" - } else { - $prog = "SASUNINST.exe" - } - start $prog - popd -} - -# Open log -$notepad2 = "$bin\Notepad2\Notepad2-Mod.exe" -if (test-path "$notepad2") { - start "$notepad2" -argumentlist $log -} else { - start "notepad" -argumentlist $log -} diff --git a/.bin/Scripts/compress_bin.cmd b/.bin/Scripts/compress_bin.cmd new file mode 100644 index 00000000..affd2362 --- /dev/null +++ b/.bin/Scripts/compress_bin.cmd @@ -0,0 +1,13 @@ +@echo off + +setlocal +pushd "%~dp0" + +for /d %%d in (*) do ( + pushd "%%d" + "%programfiles%\7-Zip\7z.exe" a -t7z -mx=9 -myx=9 -ms=on -mhe -pAbracadabra "..\%%d.7z" * + popd +) + +popd +endlocal \ No newline at end of file diff --git a/.bin/Scripts/copy_office.cmd b/.bin/Scripts/copy_office.cmd deleted file mode 100644 index eb13531b..00000000 --- a/.bin/Scripts/copy_office.cmd +++ /dev/null @@ -1,97 +0,0 @@ -@echo off - -:Flags -set silent= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:Init -setlocal EnableDelayedExpansion -title Wizard Kit: Office Installer -color 1b -echo Initializing... - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - -:SetVariables -if /i "!PROCESSOR_ARCHITECTURE!" == "AMD64" set "arch=64" -set "fastcopy=%bin%\FastCopy\FastCopy.exe" -if !arch! equ 64 ( - set "fastcopy=%bin%\FastCopy\FastCopy64.exe" -) -set "fastcopy_args=/cmd=diff /no_ui /auto_close" -rem Create %client_dir%\Office -call "%bin%\Scripts\init_client_dir.cmd" /Office -set "product=%~1" -set "source=\\10.0.0.10\Office\%product%" -set "dest=%client_dir%\Office" - -:FileOrFolder -if /i "%source%" == "" goto UsageError -if /i "%source:~-3,3%" == "exe" goto CopyFile -if /i "%source:~-3,3%" == "msi" goto CopyFile -goto CopyFolder - -:CopyFile -if not exist "%source%" goto OfficeNotFound -echo Copying installer... -start "" /wait "%fastcopy%" %fastcopy_args% "%source%" /to="%dest%\%product:0,4%\" -:: Run Setup :: -start "" "%dest%\%product:0,4%\%product:~5%" -goto Done - -:CopyFolder -if not exist "%source%\setup.exe" goto OfficeNotFound -echo Copying setup files... -start "" /wait "%fastcopy%" %fastcopy_args% "%source%" /to="%dest%\%product:0,4%\" -:: Run Setup :: -if exist "%dest%\%product:0,4%\configuration.xml" ( - pushd "%dest%\%product:0,4%" - start "" "setup.exe" /configure - popd -) else ( - start "" "%dest%\%product:0,4%\setup.exe" -) -goto Done - -:: Errors :: -:ErrorNoBin -popd -echo ERROR: ".bin" folder not found. -goto Abort - -:OfficeNotFound -echo ERROR: "%source%" not found. -goto Abort - -:UsageError -echo ERROR: Office version not specified. -echo. -echo USAGE: "%~nx0" "Path\To\Office\Setup" -goto Abort - -:Abort -color 4e -echo. -echo Aborted. -echo. -echo Press any key to exit... -pause>nul -goto Exit - -:Done -echo. -echo Done. -goto Exit - -:Exit -color -endlocal diff --git a/.bin/Scripts/diagnostics.ps1 b/.bin/Scripts/diagnostics.ps1 deleted file mode 100644 index c99693c3..00000000 --- a/.bin/Scripts/diagnostics.ps1 +++ /dev/null @@ -1,354 +0,0 @@ -# Wizard Kit: Diagnostics Tool - -## Init ## -$wd = $(Split-Path $MyInvocation.MyCommand.Path) -pushd "$wd" -. .\init.ps1 -clear -$host.UI.RawUI.WindowTitle = "Wizard Kit: Diagnostics Tool" -$backup_path = "$WKPath\Backups\$username\$date" -$logpath = "$WKPath\Info\$date" -md "$backup_path" 2>&1 | out-null -md "$logpath" 2>&1 | out-null -$log = "$logpath\Diagnostics.log" -$bin = (Get-Item $wd).Parent.FullName -$diag_dest = "/srv/Diagnostics" -$diag_server = "10.0.0.10" -$diag_user = "wkdiag" -$conemu = "$bin\cmder_mini\vendor\conemu-maximus5\ConEmu.exe" -$sz = "$bin\7-Zip\7za.exe" -$produkey = "$bin\tmp\ProduKey.exe" -$siv = "$bin\SIV\SIV.exe" - -# OS Check -. .\os_check.ps1 -if ($arch -eq 64) { - $conemu = "$bin\cmder_mini\vendor\conemu-maximus5\ConEmu64.exe" - $sz = "$bin\7-Zip\7za64.exe" - $produkey = "$bin\tmp\ProduKey64.exe" - $siv = "$bin\SIV\SIV64.exe" -} - -# Set Service Order -while ($service_order -notmatch '^\d+') { - $service_order = read-host "Please enter the service order number" - if ($service_order -notmatch '^\d+') { - write-host "ERROR: Invalid SO`r`n" -foreground "red" - } -} -clear -out-file -filepath "$logpath\TicketNumber" -inputobject $service_order -append -wk-write "Starting SW diagnostics for Ticket #$service_order" "$log" -wk-write "" "$log" - -## Sanitize Environment ## -#~# BROKEN #~# -#~# # ProcessKiller -#~# # adapted from TronScript (reddit.com/r/TronScript) and credit to /u/cuddlychops06 -#~# #wk-write "* Stopping all processes" "$log" -#~# taskkill.exe /F /FI "USERNAME eq Demo" /FI "IMAGENAME ne ClassicShellService.exe" /FI "IMAGENAME ne explorer.exe" /FI "IMAGENAME ne dwm.exe" /FI "IMAGENAME ne cmd.exe" /FI "IMAGENAME ne Taskmgr.exe" /FI "IMAGENAME ne MsMpEng.exe" /FI "IMAGENAME ne powershell.exe" /FI "IMAGENAME ne rkill.exe" /FI "IMAGENAME ne rkill64.exe" /FI "IMAGENAME ne rkill.com" /FI "IMAGENAME ne rkill64.com" /FI "IMAGENAME ne conhost.exe" /FI "IMAGENAME ne dashost.exe" /FI "IMAGENAME ne vmtoolsd.exe" /FI "IMAGENAME ne conhost.exe" 2>&1 | out-null - -# RKill -wk-write "* Running RKill" "$log" -start -wait "$conemu" -argumentlist @("/cmd", "$bin\RKill\RKill.exe", "-l", "$logpath\rkill.log") -if (!(ask "Did RKill run correctly?" "$log")) { - start -wait "$conemu" -argumentlist @("/cmd", "$bin\RKill\explorer.exe", "-l", "$logpath\rkill.log") - if (!(ask "Did RKill run correctly?" "$log")) { - wk-warn "Since RKill has failed to run, please try an alternative version." "$log" - wk-warn "Opening RKill folder..." "$log" - wk-write "" "$log" - sleep -s 2 - ii "$bin\RKill\" - pause - } -} - -# TDSSKiller Rootkit scan -wk-write "* Running Rootkit scan" "$log" -if (test-path "$bin\TDSSKiller.exe") { - md "$WKPath\Quarantine\TDSSKiller" 2>&1 | out-null - start -wait "$bin\TDSSKiller.exe" -argumentlist @("-l", "$logpath\TDSSKiller.log", "-qpath", "$WKPath\Quarantine\TDSSKiller", "-accepteula", "-accepteulaksn", "-dcexact", "-tdlfs") -} else { - wk-error " TDSSKiller.exe missing. Please verify Wizard-Kit was copied correctly." -} - -## Network Check ## -wk-write "* Testing Internet Connection" "$log" -while (!(test-connection "google.com" -count 2 -quiet)) { - wk-warn "System appears offline. Please connect to the internet." "$log" - if (!(ask "Try again?" "$log")) { - wk-error "System still appears offline; aborting script." "$log" - exit 1 - } -} - -## Misc Configuration ## -# Export current power plans -$pow_backup_path = "$WKPath\Backups\$date\Power Plans" -md "$pow_backup_path" > $null 2>&1 | out-null -foreach ($plan in (powercfg /L)) { - if ($plan -imatch '^Power Scheme.*') { - $guid = $plan -replace 'Power Scheme GUID:\s+([0-9a-f\-]+).*', '$1' - $name = $plan -replace 'Power Scheme GUID:\s+[0-9a-f\-]+\s+\(([^\)]+)\).*', '$1' - $set = ($plan -imatch '.*\*$') - if (!(test-path "$pow_backup_path\$name.pow")) { - powercfg /export "$pow_backup_path\$name.pow" $guid - } - } -} - -# Change Power Plan -wk-write "* Changing power plan to 'High Performance'" "$log" -start "powercfg.exe" -argumentlist @("-restoredefaultschemes") -nonewwindow -redirectstandardoutput out-null -start -wait "powercfg" -argumentlist @("-setactive", "8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c") -nonewwindow -redirectstandardoutput out-null - -## Begin Diagnostics ## -# Infection Scan -wk-write "* Starting background infection scan" "$log" -if ($arch -eq 64) { - $prog = "$bin\HitmanPro\HitmanPro64.exe" -} else { - $prog = "$bin\HitmanPro\HitmanPro.exe" -} -start $prog -argumentlist @("/quiet", "/noinstall", "/noupload", "/log=$logpath\hitman.xml") -workingdirectory "$bin\HitmanPro" - -#~# BROKEN #~# -#~# # OS Health Checks -#~# ## DISM -#~# if ($win_version -match '^8|10$') { -#~# start "$conemu" -argumentlist @("/cmd", "$windir\System32\dism.exe", "/online", "/cleanup-image", "/checkhealth", "/logpath:$logpath\DISM.log", "-new_console:c") -#~# } -#~# ## SFC -#~# start "$conemu" -argumentlist @("/cmd", "$windir\System32\sfc.exe", "/scannow", "-new_console:c") -#~# ## CHKDSK -#~# start "$conemu" -argumentlist @("/cmd", "$windir\System32\chkdsk.exe", "$systemdrive", "-new_console:c") - -# Backup Registry -if (!(test-path "$logpath\Registry")) { - wk-write "* Backing up registry" "$log" - start -wait "$bin\Erunt\ERUNT.EXE" -argumentlist @("$logpath\Registry", "sysreg", "curuser", "otherusers", "/noprogresswindow") -workingdirectory "$bin\Erunt" -} - -# Backup Browsers -if (test-path "$localappdata\Google\Chrome") { - wk-write "* Backing up Google Chrome" "$log" - pushd "$localappdata\Google\Chrome" - $sz_args = @( - "a", "-t7z", "-mx=1", - "$backup_path\Chrome.7z", - '"User Data"') - start $sz -argumentlist $sz_args -wait -windowstyle minimized - popd -} -if (test-path "$appdata\Mozilla\Firefox") { - wk-write "* Backing up Mozilla Firefox" "$log" - pushd "$appdata\Mozilla\Firefox" - $sz_args = @( - "a", "-t7z", "-mx=1", - "$backup_path\Firefox.7z", - "Profiles", - "profiles.ini") - start $sz -argumentlist $sz_args -wait -windowstyle minimized - popd -} -if (test-path "$userprofile\Favorites") { - wk-write "* Backing up Internet Explorer" "$log" - pushd "$userprofile" - $sz_args = @( - "a", "-t7z", "-mx=1", - "$backup_path\IE Favorites.7z", - "Favorites") - start $sz -argumentlist $sz_args -wait -windowstyle minimized - popd -} - -# Get total size of temporary files -if (!(test-path "$logpath\bleachbit.log")) { - wk-write "* Checking for temporary files" "$log" - start -wait "$bin\BleachBit\bleachbit_console.exe" -argumentlist @("--preview", "--preset") -nonewwindow -workingdirectory "$bin\BleachBit" -redirectstandarderror "$logpath\bleachbit.err" -redirectstandardoutput "$logpath\bleachbit.log" -} - -# Autoruns -if (!(test-path "$logpath\autoruns.arn")) { - wk-write "* Starting background autoruns scan" "$log" - New-Item -Path "HKCU:\Software\Sysinternals\AutoRuns" -Force 2>&1 | out-null - Set-ItemProperty -Path "HKCU:\Software\Sysinternals\AutoRuns" -Name "checkvirustotal" -Value 1 -Type "DWord" | out-null - Set-ItemProperty -Path "HKCU:\Software\Sysinternals\AutoRuns" -Name "EulaAccepted" -Value 1 -Type "DWord" | out-null - Set-ItemProperty -Path "HKCU:\Software\Sysinternals\AutoRuns" -Name "shownomicrosoft" -Value 1 -Type "DWord" | out-null - Set-ItemProperty -Path "HKCU:\Software\Sysinternals\AutoRuns" -Name "shownowindows" -Value 1 -Type "DWord" | out-null - Set-ItemProperty -Path "HKCU:\Software\Sysinternals\AutoRuns" -Name "showonlyvirustotal" -Value 1 -Type "DWord" | out-null - Set-ItemProperty -Path "HKCU:\Software\Sysinternals\AutoRuns" -Name "submitvirustotal" -Value 0 -Type "DWord" | out-null - Set-ItemProperty -Path "HKCU:\Software\Sysinternals\AutoRuns" -Name "verifysignatures" -Value 1 -Type "DWord" | out-null - New-Item "HKCU:\Software\Sysinternals\AutoRuns\SigCheck" 2>&1 | out-null - Set-ItemProperty -Path "HKCU:\Software\Sysinternals\AutoRuns\SigCheck" -Name "EulaAccepted" -Value 1 -Type "DWord" | out-null - New-Item "HKCU:\Software\Sysinternals\AutoRuns\Streams" 2>&1 | out-null - Set-ItemProperty -Path "HKCU:\Software\Sysinternals\AutoRuns\Streams" -Name "EulaAccepted" -Value 1 -Type "DWord" | out-null - New-Item "HKCU:\Software\Sysinternals\AutoRuns\VirusTotal" 2>&1 | out-null - Set-ItemProperty -Path "HKCU:\Software\Sysinternals\AutoRuns\VirusTotal" -Name "VirusTotalTermsAccepted" -Value 1 -Type "DWord" | out-null - start "$bin\SysinternalsSuite\autoruns.exe" -workingdirectory "$bin\SysinternalsSuite" -windowstyle "minimized" -} - -# AIDA64 -if (!(test-path "$logpath\keys-aida64.txt")) { - wk-write "* Running AIDA64 (Product Keys)" "$log" - start -wait "$bin\AIDA64\aida64.exe" -argumentlist @("/R", "$logpath\keys-aida64.txt", "/CUSTOM", "$bin\AIDA64\licenses.rpf", "/TEXT", "/SILENT", "/SAFEST") -workingdirectory "$bin\AIDA64" -} - -if (!(test-path "$logpath\program_list-aida64.txt")) { - wk-write "* Running AIDA64 (SW listing)" "$log" - start -wait "$bin\AIDA64\aida64.exe" -argumentlist @("/R", "$logpath\program_list-aida64.txt", "/CUSTOM", "$bin\AIDA64\installed_programs.rpf", "/TEXT", "/SILENT", "/SAFEST") -workingdirectory "$bin\AIDA64" -} - -if (!(test-path "$logpath\aida64.htm")) { - wk-write "* Running AIDA64 (Full listing) in background" "$log" - start "$bin\AIDA64\aida64.exe" -argumentlist @("/R", "$logpath\aida64.html", "/CUSTOM", "$bin\AIDA64\full.rpf", "/HTML", "/SILENT") -workingdirectory "$bin\AIDA64" -} - -# SIV -if (!(test-path "$logpath\keys-siv.txt")) { - wk-write "* Running SIV (Product Keys)" "$log" - start -wait "$siv" -argumentlist @("-KEYS", "-LOCAL", "-UNICODE", "-SAVE=[product-ids]=$logpath\keys-siv.txt") -workingdirectory "$bin\SIV" -} - -if (!(test-path "$logpath\program_list-siv.txt")) { - wk-write "* Running SIV (SW listing)" "$log" - start -wait "$siv" -argumentlist @("-KEYS", "-LOCAL", "-UNICODE", "-SAVE=[software]=$logpath\program_list-siv.txt") -workingdirectory "$bin\SIV" -} - -if (!(test-path "$logpath\aida64.htm")) { - wk-write "* Running SIV (Full listing) in background" "$log" - start -wait "$siv" -argumentlist @("-KEYS", "-LOCAL", "-UNICODE", "-SAVE=$logpath\siv.txt") -workingdirectory "$bin\SIV" -} - -# Product Keys -## Extract -md "$bin\tmp" 2>&1 | out-null -start -wait $sz -argumentlist @("e", "$bin\ProduKey.7z", "-otmp", "-aoa", "-pAbracadabra", "-bsp0", "-bso0") -workingdirectory "$bin" -nonewwindow -rm "$bin\tmp\ProduKey*.cfg" -sleep -s 1 - -## Run -if (!(test-path "$logpath\keys-produkey.txt")) { - wk-write "* Saving Product Keys" "$log" - start -wait $produkey -argumentlist @("/nosavereg", "/stext", "$logpath\keys-produkey.txt") -workingdirectory "$bin\tmp" -} - -## Summary ## -wk-write "" "$log" - -# Removed temp file size -wk-write "==== Temp Files ====" "$log" -$bb = (gc "$logpath\bleachbit.log") -imatch '^(disk space.*recovered|files.*deleted)' -foreach ($_ in $bb) { - $_ = " " + $_ - wk-write $_ "$log" -} -wk-write "" "$log" - -# Free Space -wk-write "==== Free Space ====" "$log" -& "$wd\free_space.ps1" "$log" -wk-write "" "$log" - -# RAM -wk-write "==== RAM ====" "$log" -& "$wd\installed_ram.ps1" "$log" -wk-write "" "$log" - -# List installed Office programs -wk-write "==== Installed Office Programs ====" "$log" -$installed_office = (gc "$logpath\program_list-aida64.txt") -imatch 'Office' | sort -foreach ($_ in $installed_office) { - $_ = $_ -ireplace '^\s+(.*?)\s\s+.*', '$1' - wk-write " $_" "$log" -} -wk-write "" "$log" - -# Saved keys -wk-write "==== Found Product Keys ====" "$log" -$keys = (gc "$logpath\keys-produkey.txt") -imatch '(product.name)' -foreach ($_ in $keys) { - $_ = $_ -ireplace '^product name\s+: ', ' ' - wk-write $_ "$log" -} -wk-write "" "$log" - - -# OS Info -wk-write "==== Operating System ====" "$log" -if ($arch -eq 32) { - wk-error " $os_name x$arch" "$log" -} elseif ($win_info.CurrentVersion -match "6.0") { - if ($win_info.CurrentBuildNumber -match "6002") { - wk-warn " $os_name x$arch" "$log" - } elseif ($win_info.CurrentBuildNumber -match "6001") { - wk-error " $os_name x$arch (very out of date)" "$log" - } elseif ($win_info.CurrentBuildNumber -match "6000") { - wk-error " $os_name x$arch (very out of date)" "$log" - } -} elseif ($win_info.CurrentVersion -match "6.2") { - wk-error " $os_name x$arch (very out of date)" "$log" -} elseif ($win_info.CurrentBuildNumber -match "10240") { - wk-error " $os_name x$arch (Release 1511 not installed)" "$log" -} else { - wk-write " $os_name x$arch" "$log" -} -if ($win_act -imatch 'unavailable') { - wk-warn "$win_act" "$log" -} elseif ($win_act -notmatch "permanent") { - wk-error "$win_act" "$log" -} else { - wk-write "$win_act" "$log" -} -wk-write "" "$log" - -# Updates Check -# TODO: Finish and test this -#wk-write "==== Windows Updates ====" "$log" -#import-module "$bin\Scripts\PSWindowsUpdate" -# Check last install date -#get-wuhistory | sort-object date -descending | select-object -first 1 -# Check if installs CS -# TODO -# Return avail updates -#get-wulist -#wk-write "" "$log" - -# Battery Check -wk-write "==== Battery Check ====" "$log" -& "$wd\check_battery.ps1" "$log" -wk-write "" "$log" - -# User Data -wk-write "==== User Data ====" "$log" -& "$wd\user_data.ps1" "$log" -wk-write "" "$log" - -# Upload info -write-host "Uploading info to NAS..." - -## Write batch -$batch = "lcd `"{0}`"`r`n" -f $WKPath -$batch += "cd `"{0}`"`r`n" -f $diag_dest -$batch += "put -r Info `"{0}`"`r`n" -f $service_order -out-file -encoding "ASCII" -filepath "$wd\psftp_batch" -inputobject $batch - -## Upload files -$psftp_args = @( - "-noagent", - "-i", "$bin\PuTTY\WK.ppk", - "$diag_user@$diag_server", - "-b", "$wd\psftp_batch") -start "$bin\PuTTY\PSFTP.exe" -argumentlist $psftp_args -wait -windowstyle minimized - -## Done ## -popd -pause "Press Enter to exit..." - -# Open log -$notepad2 = "$bin\Notepad2\Notepad2-Mod.exe" -if (test-path $notepad2) { - start "$notepad2" -argumentlist $log -} else { - start "notepad" -argumentlist $log -} diff --git a/.bin/Scripts/dism.ps1 b/.bin/Scripts/dism.ps1 deleted file mode 100644 index 2dbb2aa9..00000000 --- a/.bin/Scripts/dism.ps1 +++ /dev/null @@ -1,31 +0,0 @@ -# Wizard Kit: DISM wrapper - -## Init ## -$wd = $(Split-Path $MyInvocation.MyCommand.Path) -pushd "$wd" -. .\init.ps1 -clear -$host.UI.RawUI.WindowTitle = "Wizard Kit: DISM wrapper" -$logpath = "$ClientPath\Info\$date" -md "$logpath" 2>&1 | out-null -$log = "$logpath\DISM.log" -$bin = (Get-Item $wd).Parent.FullName - -# OS Check -. .\check_os.ps1 -if ($win_version -notmatch '^8|10$') { - WK-error "This tool is not intended for $os_name." -} else { - # Get mode - $modes = @( - @{Name="Check Health"; Command="/CheckHealth"} - @{Name="Restore Health"; Command="/Online /Cleanup-Image /RestoreHealth"} - ) - $selection = (menu-select "WK DISM Wrapper" "Please select action to perform" $modes) - $command = "DISM {0}" -f $modes[$selection - 1].Command - sleep -s 1 - start "DISM" -argumentlist @("/Online", "/Cleanup-Image", "$command", "/LogPath:$log") -NoNewWindow -Wait -RunAs -} - -# Done -pause "Press any key to exit..." \ No newline at end of file diff --git a/.bin/Scripts/dism.py b/.bin/Scripts/dism.py new file mode 100644 index 00000000..15d75e9e --- /dev/null +++ b/.bin/Scripts/dism.py @@ -0,0 +1,96 @@ +# Wizard Kit: DISM wrapper + +import os +import subprocess + +# Init +os.chdir(os.path.dirname(os.path.realpath(__file__))) +os.system('title Wizard Kit: DISM helper Tool') +from functions import * +vars_wk = init_vars_wk() +vars_wk.update(init_vars_os()) +os.makedirs('{LogDir}'.format(**vars_wk), exist_ok=True) +vars_wk['LogFile'] = '{LogDir}\\dism_helper.log'.format(**vars_wk) + +def abort(): + print_warning('Aborted.', vars_wk['LogFile']) + exit_script() + +def exit_script(): + pause("Press Enter to exit...") + quit() + +def check_health(): + _args = [ + '/Online', + '/Cleanup-Image', + '/CheckHealth', + '/LogPath:{LogDir}\\DISM_CheckHealth.log'.format(**vars_wk)] + try: + _result = run_program('dism', _args).stdout.decode() + except subprocess.CalledProcessError: + print_error('ERROR: failed to run DISM health check', vars_wk['LogFile']) + _result = ['Unknown'] + else: + # Check result + if re.search(r'No component store corruption detected', _result, re.IGNORECASE): + return True + else: + for line in _result: + line = ' ' + line + print_warning(line, vars_wk['LogFile']) + print_error('ERROR: DISM encountered errors, please review details above', vars_wk['LogFile']) + return False + +def restore_health(): + _args = [ + '/Online', + '/Cleanup-Image', + '/RestoreHealth', + '/LogPath:{LogDir}\\DISM_RestoreHealth.log'.format(**vars_wk), + '-new_console:n', + '-new_console:s33V'] + run_program('dism', _args, pipe=False, check=False) + wait_for_process('dism') + +def scan_health(): + _args = [ + '/Online', + '/Cleanup-Image', + '/ScanHealth', + '/LogPath:{LogDir}\\DISM_ScanHealth.log'.format(**vars_wk), + '-new_console:n', + '-new_console:s33V'] + run_program('dism', _args, pipe=False, check=False) + wait_for_process('dism') + +if __name__ == '__main__': + stay_awake(vars_wk) + if vars_wk['Version'] in ['8', '10']: + options = [ + {'Name': 'Check Health', 'Command': 'Check'}, + {'Name': 'Restore Health', 'Command': 'Restore'}] + actions = [{'Name': 'Quit', 'Letter': 'Q'}] + selection = menu_select('Please select action to perform', options, actions) + run_program('cls', check=False, pipe=False, shell=True) + if selection == 'Q': + abort() + elif options[int(selection)-1]['Command'] == 'Check': + print_info('Scanning for component store corruption...', vars_wk['LogFile']) + scan_health() + if check_health(): + print_success('No component store corruption detected.', vars_wk['LogFile']) + elif options[int(selection)-1]['Command'] == 'Restore': + print_info('Scanning for, and attempting to repair, component store corruption...', vars_wk['LogFile']) + restore_health() + if check_health(): + print_success('No component store corruption detected.', vars_wk['LogFile']) + else: + abort() + else: + # Windows 7 and older + print_error('ERROR: This tool is not intended for {ProductName}.'.format(**vars_wk), vars_wk['LogFile']) + + print_success('Done.', vars_wk['LogFile']) + kill_process('caffeine.exe') + exit_script() diff --git a/.bin/Scripts/enter_safemode.ps1 b/.bin/Scripts/enter_safemode.ps1 deleted file mode 100644 index 85941a85..00000000 --- a/.bin/Scripts/enter_safemode.ps1 +++ /dev/null @@ -1,27 +0,0 @@ -# Wizard Kit: Enter SafeMode by setting it as {default} - -## Init ## -$wd = $(Split-Path $MyInvocation.MyCommand.Path) -pushd "$wd" -. .\init.ps1 -clear -$host.UI.RawUI.WindowTitle = "Wizard Kit: SafeMode Tool" - -# Ask user -if (!(ask "Enable booting to SafeMode (with Networking)?")) { - popd - exit 1 -} - -## Configure OS ## -# Edit BCD -start -wait "bcdedit" -argumentlist @("/set", "{default}", "safeboot", "network") -nonewwindow - -# Enable MSI access under safemode -New-Item "HKLM:\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\MSIServer" 2>&1 | out-null -Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\MSIServer" -Name "(Default)" -Value "Service" -Type "String" -Force | out-null - -## Done ## -popd -pause "Press Enter to reboot..." -restart-computer diff --git a/.bin/Scripts/exit_safemode.ps1 b/.bin/Scripts/exit_safemode.ps1 deleted file mode 100644 index a4815b76..00000000 --- a/.bin/Scripts/exit_safemode.ps1 +++ /dev/null @@ -1,27 +0,0 @@ -# Wizard Kit: Exit SafeMode removing safeboot from {default} - -## Init ## -$wd = $(Split-Path $MyInvocation.MyCommand.Path) -pushd "$wd" -. .\init.ps1 -clear -$host.UI.RawUI.WindowTitle = "Wizard Kit: SafeMode Tool" - -# Ask user -if (!(ask "Disable booting to SafeMode?")) { - popd - exit 1 -} - -## Configure OS ## -# Edit BCD -start -wait "bcdedit" -argumentlist @("/deletevalue", "{current}", "safeboot") -nonewwindow -start -wait "bcdedit" -argumentlist @("/deletevalue", "{default}", "safeboot") -nonewwindow - -# Disable MSI access under safemode -Remove-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\MSIServer" -Recurse 2>&1 | out-null - -## Done ## -popd -pause "Press Enter to reboot..." -restart-computer diff --git a/.bin/Scripts/final_checklist.ps1 b/.bin/Scripts/final_checklist.ps1 deleted file mode 100644 index 92779c1c..00000000 --- a/.bin/Scripts/final_checklist.ps1 +++ /dev/null @@ -1,291 +0,0 @@ -# Wizard Kit: Final Checklist - -## Init ## -$wd = $(Split-Path $MyInvocation.MyCommand.Path) -pushd "$wd" -. .\init.ps1 -clear -$host.UI.RawUI.WindowTitle = "Wizard Kit: Checklist Tool" -$logpath = "$ClientPath\Info\$date" -md "$logpath" 2>&1 | out-null -$log = "$logpath\Checklist.log" -$bin = (Get-Item $wd).Parent.FullName -$diag_dest = "/srv/Diagnostics" -$diag_server = "10.0.0.10" -$diag_user = "WKdiag" -$sz = "$bin\7-Zip\7za.exe" -$produkey = "$bin\tmp\ProduKey.exe" - -# OS Check -. .\check_os.ps1 -if ($arch -eq 64) { - $sz = "$bin\7-Zip\7za64.exe" - $produkey = "$bin\tmp\ProduKey64.exe" -} - -# Set Service Order -while ($service_order -notmatch '^\d+') { - $service_order = read-host "Please enter the service order number" - if ($service_order -notmatch '^\d+') { - write-host "ERROR: Invalid SO`r`n" -foreground "red" - } -} -clear -out-file -filepath "$logpath\TicketNumber" -inputobject $service_order -append -WK-write "Starting final checklist for Ticket #$service_order" "$log" -WK-write "" "$log" - -## Cleanup ## -WK-write "Pre-Checklist Cleanup" "$log" - -# Uninstall AdwCleaner -if (test-path "$systemdrive\AdwCleaner") { - try { - WK-write "* Uninstalling AdwCleaner" "$log" - move-item "$systemdrive\AdwCleaner\*log" "$ClientPath\Info\" - move-item "$systemdrive\AdwCleaner\*txt" "$ClientPath\Info\" - if (test-path "$systemdrive\AdwCleaner\Quarantine") { - move-item "$systemdrive\AdwCleaner\Quarantine" "$ClientPath\Quarantine\AdwCleaner" - } - remove-item "$systemdrive\AdwCleaner" -recurse - } catch { - WK-error " Failed to uninstall AdwCleaner; please remove manually." "$log" - } -} - -# Uninstall Autoruns -if (test-path "HKCU:\Software\Sysinternals\AutoRuns") { - WK-write "* Uninstalling Autoruns" "$log" - Remove-Item -Path HKCU:\Software\Sysinternals\AutoRuns -Recurse 2>&1 | out-null - if ((Get-ChildItem -Path HKCU:\Software\Sysinternals 2> out-null | Measure-Object).count -eq 0) { - Remove-Item -Path HKCU:\Software\Sysinternals 2>&1 | out-null - } -} - -# Uninstall ESET -if (test-path "$programfiles86\ESET\ESET Online Scanner") { - WK-write "* Uninstalling ESET" "$log" - start -wait "$programfiles86\ESET\ESET Online Scanner\OnlineScannerUninstaller.exe" -argumentlist "/s" - rm -path "$programfiles86\ESET\ESET Online Scanner" -recurse 2>&1 | out-null - if ((gci -path "$programfiles86\ESET" 2> out-null | Measure-Object).count -eq 0) { - rm -path "$programfiles86\ESET" 2>&1 | out-null - } -} - -# Move JRT logs & backups -if (test-path "$userprofile\Desktop\JRT*") { - WK-write "* Cleaning up JRT leftovers" "$log" - WK-warn " TODO" "$log" -} - -# Uninstall MBAM -if (test-path "$programfiles86\Malwarebytes") { - WK-warn "Malwarebytes Anti-Malware installation found." "$log" - if (ask " Uninstall?" "$log") { - WK-write "* Uninstalling Malwarebytes Anti-Malware" "$log" - WK-warn " TODO" "$log" - } -} - -# Move RKill logs & backups -if (test-path "$userprofile\Desktop\rkill*") { - WK-write "* Cleaning up RKill leftovers" "$log" - WK-warn " TODO" "$log" -} - -# Uninstall SUPERAntiSpyware -# It is always in programfiles (not x86) ?? -$sas_force_remove = $false -if (test-path "$programfiles\SUPERAntiSpyware") { - WK-warn "SUPERAntiSpyware installation found." "$log" - if (ask " Uninstall?" "$log") { - if (test-path "$programfiles\SUPERAntiSpyware\Uninstall.exe") { - WK-write "* Uninstalling SUPERAntiSpyware" "$log" - start -wait "$programfiles\SUPERAntiSpyware\Uninstall.exe" - } else { - WK-error "The SUPERAntiSpyware removal tool will be used as the installation is damaged" "$log" - $sas_force_remove = $true - } - } -} - -## Summary ## -WK-write "" "$log" -WK-write "Starting SW Checklist" "$log" -WK-write "" "$log" - -# Backup Registry -if (!(test-path "$logpath\Registry")) { - WK-write "* Backing up registry" "$log" - start -wait "$bin\Erunt\ERUNT.EXE" -argumentlist @("$logpath\Registry", "sysreg", "curuser", "otherusers", "/noprogresswindow") -workingdirectory "$bin\Erunt" -} - -# AIDA64 -if (!(test-path "$logpath\keys-aida64.txt")) { - WK-write "* Running AIDA64 (Product Keys)" "$log" - start -wait "$bin\AIDA64\aida64.exe" -argumentlist @("/R", "$logpath\keys-aida64.txt", "/CUSTOM", "$bin\AIDA64\licenses.rpf", "/TEXT", "/SILENT", "/SAFEST") -workingdirectory "$bin\AIDA64" -} - -if (!(test-path "$logpath\program_list-aida64.txt")) { - WK-write "* Running AIDA64 (SW listing)" "$log" - start -wait "$bin\AIDA64\aida64.exe" -argumentlist @("/R", "$logpath\program_list-aida64.txt", "/CUSTOM", "$bin\AIDA64\installed_programs.rpf", "/TEXT", "/SILENT", "/SAFEST") -workingdirectory "$bin\AIDA64" -} - -if (!(test-path "$logpath\aida64.htm")) { - WK-write "* Running AIDA64 (Full listing) in background" "$log" - start "$bin\AIDA64\aida64.exe" -argumentlist @("/R", "$logpath\aida64.html", "/CUSTOM", "$bin\AIDA64\full.rpf", "/HTML", "/SILENT") -workingdirectory "$bin\AIDA64" -} - -# SIV -if (!(test-path "$logpath\keys-siv.txt")) { - WK-write "* Running SIV (Product Keys)" "$log" - start -wait "$siv" -argumentlist @("-KEYS", "-LOCAL", "-UNICODE", "-SAVE=[product-ids]=$logpath\keys-siv.txt") -workingdirectory "$bin\SIV" -} - -if (!(test-path "$logpath\program_list-siv.txt")) { - WK-write "* Running SIV (SW listing)" "$log" - start -wait "$siv" -argumentlist @("-KEYS", "-LOCAL", "-UNICODE", "-SAVE=[software]=$logpath\program_list-siv.txt") -workingdirectory "$bin\SIV" -} - -if (!(test-path "$logpath\aida64.htm")) { - WK-write "* Running SIV (Full listing) in background" "$log" - start -wait "$siv" -argumentlist @("-KEYS", "-LOCAL", "-UNICODE", "-SAVE=$logpath\siv.txt") -workingdirectory "$bin\SIV" -} - -# Product Keys -## Extract -md "$bin\tmp" 2>&1 | out-null -start -wait $sz -argumentlist @("e", "$bin\ProduKey.7z", "-otmp", "-aoa", "-pAbracadabra", "-bsp0", "-bso0") -workingdirectory "$bin" -nonewwindow -rm "$bin\tmp\ProduKey*.cfg" -sleep -s 1 - -## Run -if (!(test-path "$logpath\keys-produkey.txt")) { - WK-write "* Saving Product Keys" "$log" - start -wait $produkey -argumentlist @("/nosavereg", "/stext", "$logpath\keys-produkey.txt") -workingdirectory "$bin\tmp" -} - -# User Data -WK-write "==== User Data ====" "$log" -& "$wd\user_data.ps1" "$log" -WK-write "" "$log" - -# OS Info -WK-write "==== Operating System ====" "$log" -WK-write " $os_name x$arch" "$log" -WK-write "$win_act" "$log" -if ($win_act -notmatch "permanent") {slui} -WK-write "" "$log" - -# Set Timezone and sync clock -WK-write "==== Clock ====" "$log" -start "tzutil" -argumentlist @("/s", '"Pacific Standard Time"') -nonewwindow -redirectstandardoutput out-null -stop-service -name "w32time" 2>&1 | out-null -start "w32tm" -argumentlist @("/config", "/syncfromflags:manual", '/manualpeerlist:"us.pool.ntp.org time.nist.gov time.windows.com"') -nonewwindow -redirectstandardoutput out-null -start-service -name "w32time" 2>&1 | out-null -start "w32tm" -argumentlist "/resync" -nonewwindow -redirectstandardoutput out-null -# gross assumption that tz=PST (should've been set earlier) -WK-write $(get-date -uformat " %a %Y-%m-%d %H:%m (PST/PDT)") "$log" -WK-write "" "$log" - -### DISABLED FOR NOW ### -## Reset power plans -#WK-write "==== Reset Power Plans ====" "$log" -## Export current power plans -#$pow_backup_path = "$ClientPath\Backups\$date\Power Plans" -#md "$pow_backup_path" > $null 2>&1 | out-null -#$old_power_plans = @() -#foreach ($plan in (powercfg /L)) { -# if ($plan -imatch '^Power Scheme.*') { -# $guid = $plan -replace 'Power Scheme GUID:\s+([0-9a-f\-]+).*', '$1' -# $name = $plan -replace 'Power Scheme GUID:\s+[0-9a-f\-]+\s+\(([^\)]+)\).*', '$1' -# $set = ($plan -imatch '.*\*$') -# $old_power_plans += @{GUID = $guid; Name = $name; Set = $set} -# if (!(test-path "$pow_backup_path\$name.pow")) { -# powercfg /export "$pow_backup_path\$name.pow" $guid -# } -# } -#} -# -#start "powercfg.exe" -argumentlist "-restoredefaultschemes" -nonewwindow -redirectstandardoutput out-null -#WK-write " All power plans reset to defaults" "$log" -## TODO: Re-add and reset SSD plan(s) -#WK-warn " If the system has a SSD please verify the correct plan has been selected" "$log" -#WK-write "" "$log" -### DISABLED FOR NOW ### - -# Free Space -WK-write "==== Free Space ====" "$log" -& "$wd\free_space.ps1" "$log" -WK-write "" "$log" - -# RAM -WK-write "==== RAM ====" "$log" -& "$wd\installed_ram.ps1" "$log" -WK-write "" "$log" - -# Battery Check -WK-write "==== Battery Check ====" "$log" -& "$wd\check_battery.ps1" "$log" -WK-write "" "$log" - -## Launch Extra Tools ## -# HWMonitor -if ($arch -eq 64) { - $prog = "$bin\HWMonitor\HWMonitor64.exe" -} else { - $prog = "$bin\HWMonitor\HWMonitor.exe" -} -start $prog - -# XMPlay -start "$bin\..\Misc\XMPlay.cmd" - -## Upload info ## -write-host "Uploading info to NAS..." - -# Write batch -$batch = "lcd `"{0}`"`r`n" -f $ClientPath -$batch += "cd `"{0}`"`r`n" -f $diag_dest -$batch += "put -r Info `"{0}`"`r`n" -f $service_order -out-file -encoding "ASCII" -filepath "$wd\psftp_batch" -inputobject $batch - -# Upload files -$psftp_args = @( - "-noagent", - "-i", "$bin\PuTTY\WK.ppk", - "$diag_user@$diag_server", - "-b", "$wd\psftp_batch") -start "$bin\PuTTY\PSFTP.exe" -argumentlist $psftp_args -wait -windowstyle minimized - -## Done ## -popd -pause "Press Enter to review drivers and updates..." - -# Launch post progs -start devmgmt.msc -if ($win_version -eq 10) { - start ms-settings:windowsupdate -} else { - start wuapp -} - -# Launch SAS Removal Tool (if necessary) -if ($sas_force_remove) { - pushd "$bin\_Removal Tools" - if ($arch -eq 64) { - $prog = "SASUNINST64.exe" - } else { - $prog = "SASUNINST.exe" - } - start $prog - popd -} - -# Open log -$notepad2 = "$bin\Notepad2\Notepad2-Mod.exe" -if (test-path "$notepad2") { - start "$notepad2" -argumentlist $log -} else { - start "notepad" -argumentlist $log -} diff --git a/.bin/Scripts/free_space.ps1 b/.bin/Scripts/free_space.ps1 deleted file mode 100644 index db9f0789..00000000 --- a/.bin/Scripts/free_space.ps1 +++ /dev/null @@ -1,34 +0,0 @@ -# Wizard Kit: List free space for all drives - -param([string]$log) - -cd $(Split-Path $MyInvocation.MyCommand.Path) -. .\init.ps1 - -foreach ($d in [char]'C'..[char]'Z') { - $letter = "$([char]$d):" - if (-not $(test-path "$letter\")) {continue} - $drive = $(fsutil volume diskfree $letter) -replace '^.*: ','' - if ($lastexitcode -ne 0) {continue} - $percent = ($drive[2] / $drive[1]) * 100 - foreach ($x in 0,1,2) { - $tmp = [int64]$drive[$x] - if ($tmp -ge 1tb) { - $tmp /= 1tb - $tmp = "{0:N2} Tb" -f $tmp - } elseif ($tmp -ge 1gb) { - $tmp /= 1gb - $tmp = "{0:N2} Gb" -f $tmp - } elseif ($tmp -ge 1mb) { - $tmp /= 1mb - $tmp = "{0:N2} Mb" -f $tmp - } elseif ($tmp -ge 1kb) { - $tmp /= 1kb - $tmp = "{0:N2} Kb" -f $tmp - } else { - $tmp = "$tmp bytes" - } - $drive[$x] = $tmp - } - WK-write $(" {0} {1:N0}% Free ({2} / {3})" -f $letter, $percent, $drive[2], $drive[1]) $log -} diff --git a/.bin/Scripts/functions.py b/.bin/Scripts/functions.py index 8d2c09c4..16f46cc0 100644 --- a/.bin/Scripts/functions.py +++ b/.bin/Scripts/functions.py @@ -2,13 +2,21 @@ import os import partition_uids +import psutil import re import shutil import subprocess import time import winreg -# Server info +# STATIC VARIABLES +ARCHIVE_PASSWORD='Abracadabra' +COLORS = { + 'CLEAR': '\033[0m', + 'RED': '\033[31m', + 'GREEN': '\033[32m', + 'YELLOW': '\033[33m', + 'BLUE': '\033[34m'} BACKUP_SERVERS = [ { 'IP': '10.0.0.10', 'Mounted': False, @@ -25,6 +33,11 @@ BACKUP_SERVERS = [ 'Pass': 'Abracadabra', }, ] +CLIENT_INFO_SERVER = { + 'IP': '10.0.0.10', + 'Share': '/srv/ClientInfo', + 'User': 'wkdiag', +} OFFICE_SERVER = { 'IP': '10.0.0.10', 'Name': 'ServerOne', @@ -41,18 +54,26 @@ WINDOWS_SERVER = { 'User': 'restore', # Using these credentials in case the backup shares are also mounted. 'Pass': 'Abracadabra', # This is because Windows only allows one set of credentials to be used per server at a time. } - -# Colors -COLORS = { - 'CLEAR': '\033[0m', - 'RED': '\033[31m', - 'GREEN': '\033[32m', - 'YELLOW': '\033[33m', - 'BLUE': '\033[34m'} +SHELL_FOLDERS = { + #GUIDs from: https://msdn.microsoft.com/en-us/library/windows/desktop/dd378457(v=vs.85).aspx + 'Desktop': ('{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}'), + 'Documents': ('Personal', '{FDD39AD0-238F-46AF-ADB4-6C85480369C7}'), + 'Downloads': ('{374DE290-123F-4565-9164-39C4925E467B}'), + 'Favorites': ('{1777F761-68AD-4D8A-87BD-30B759FA33DD}'), + 'Music': ('My Music', '{4BD8D571-6D19-48D3-BE97-422220080E43}'), + 'Pictures': ('My Pictures', '{33E28130-4E1E-4676-835A-98395C3BC3BB}'), + 'Videos': ('My Video', '{18989B1D-99B5-455B-841C-AB7C74E4DDFC}'), +} +EXTRA_FOLDERS = [ + 'Dropbox', + 'Google Drive', + 'OneDrive', + 'SkyDrive', +] # General functions -def ask(prompt='Kotaero'): - """Prompt the user with a Y/N question and return a bool.""" +def ask(prompt='Kotaero!', log_file=None): + """Prompt the user with a Y/N question, log answer, and return a bool.""" answer = None prompt = prompt + ' [Y/N]: ' while answer is None: @@ -61,6 +82,12 @@ def ask(prompt='Kotaero'): answer = True elif re.search(r'^n(o|ope|)$', tmp): answer = False + if log_file is not None: + with open(log_file, 'a') as f: + if answer: + f.write('{prompt}Yes\n'.format(prompt=prompt)) + else: + f.write('{prompt}No\n'.format(prompt=prompt)) return answer def assign_volume_letters(): @@ -98,6 +125,21 @@ def convert_to_bytes(size): return size +def extract_item(item=None, vars_wk=None, filter='', silent=False): + """Extract item from .cbin into .bin.""" + if item is None or vars_wk is None: + raise Exception + vars_wk['SevenZip'] = '{BinDir}\\7-Zip\\7za.exe'.format(**vars_wk) + if vars_wk['Arch'] == 64: + vars_wk['SevenZip'] = vars_wk['SevenZip'].replace('7za.exe', '7za64.exe') + _cmd = '{SevenZip} x -aos -bso0 -bse0 -p{ArchivePassword} -o"{BinDir}\\{item}" "{CBinDir}\\{item}.7z" {filter}'.format(item=item, filter=filter, **vars_wk) + if not silent: + print_standard('Extracting "{item}"...'.format(item=item)) + try: + run_program(_cmd, shell=True) + except subprocess.CalledProcessError: + print_warning('WARNING: Errors encountered while exctracting data', log_file=vars_wk['LogFile']) + def find_windows_image(filename=None): """Search for an image file on local and network drives and return a dict.""" image = {} @@ -210,7 +252,7 @@ def format_mbr(disk=None): def get_attached_disk_info(): """Get details about the attached disks and return a list of dicts.""" disks = [] - print_info('Getting drive info...') + # print_info('Getting drive info...') # Assign all the letters assign_volume_letters() @@ -305,6 +347,175 @@ def get_attached_disk_info(): # Done return disks +def get_free_space_info(): + """Get free space info for all fixed volumes and return a list of lists.""" + drives = run_program('fsutil fsinfo drives', check=False) + drives = drives.stdout.decode() + drives = drives.replace('Drives: ', '').replace('\\', '').split() + _return = [] + for drive in sorted(drives): + _out = run_program('fsutil fsinfo drivetype {drive}'.format(drive=drive)) + _drive_type = _out.stdout.decode() + if re.search(r'Fixed Drive', _drive_type, re.IGNORECASE): + try: + _out = run_program('fsutil volume diskfree {drive}'.format(drive=drive)) + _out = _out.stdout.decode().splitlines() + _free = int(re.sub(r'.*:\s+(.*)', r'\1', _out[0])) + _total = int(re.sub(r'.*:\s+(.*)', r'\1', _out[1])) + _str = '{percent:>6.2f}% Free ({free} / {total})'.format( + percent = _free/_total, + free = human_readable_size(_free, 2), + total = human_readable_size(_total, 2)) + _return.append([drive, _str]) + except subprocess.CalledProcessError: + pass + return _return + +def get_user_data_size_info(vars_wk=None): + """Get size of user folders for all users and return a dict of dicts.""" + if vars_wk is None: + raise Exception + users = {} + TMP_HIVE_PATH = 'HKU\\wk_tmp' + + # Extract and configure du + extract_item('SysinternalsSuite', vars_wk, filter='du*', silent=True) + du = '{BinDir}\\SysinternalsSuite\\du.exe'.format(**vars_wk) + if vars_wk['Arch'] == 64: + du = du.replace('.exe', '64.exe') + winreg.CreateKey(winreg.HKEY_CURRENT_USER, r'Software\Sysinternals\Du') + with winreg.OpenKey(winreg.HKEY_CURRENT_USER, r'Software\Sysinternals\Du', access=winreg.KEY_WRITE) as _key: + winreg.SetValueEx(_key, 'EulaAccepted', 0, winreg.REG_DWORD, 1) + + try: + # Get SIDs + out = run_program('wmic useraccount get sid') + sids = out.stdout.decode().splitlines() + sids = [s.strip() for s in sids if re.search(r'-1\d+$', s.strip())] + + # Get Usernames and add to _users + for sid in sids: + try: + out = run_program('wmic useraccount where sid="{sid}" get name'.format(sid=sid)) + name = out.stdout.decode().splitlines()[2].strip() + users[name] = {'Extra Folders': {}, 'Shell Folders': {}, 'SID': sid} + except: + # Just skip problem users + pass + except subprocess.CalledProcessError: + # This results in an empty dict being returned, leaving it to the calling section to handle that case + pass + + # Use username/SID pairs to check profile folder sizes + for u in users.keys(): + try: + # Main Profile path + key = r'SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\{SID}'.format(**users[u]) + with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, key) as _key: + users[u]['ProfileImagePath'] = winreg.QueryValueEx(_key, 'ProfileImagePath')[0] + try: + out = run_program(du, ['-nobanner', '-q', users[u]['ProfileImagePath']]) + size = out.stdout.decode().splitlines()[4] + size = re.sub(r'Size:\s+([\d,]+)\sbytes$', r'\1', size) + size = size.replace(',', '') + size = human_readable_size(size) + size_str = '{folder:<20} {size:>10} ({path})'.format(folder='Profile', size=size, path=users[u]['ProfileImagePath']) + users[u]['ProfileSize'] = size_str + except subprocess.CalledProcessError: + # Failed to get folder size + pass + + # Check if user hive is already loaded + unload_hive = False + try: + # This tests if the user hive is already loaded and throws FileNotFoundError if not. + winreg.QueryValue(winreg.HKEY_USERS, users[u]['SID']) + except FileNotFoundError: + # User not logged-in. Loading hive and setting unload_hive so it will be unloaded before the script exits. + try: + _cmd = 'reg load {tmp_path} "{ProfileImagePath}\\NTUSER.DAT"'.format(tmp_path=TMP_HIVE_PATH, **users[u]) + run_program(_cmd) + unload_hive = True + except subprocess.CalledProcessError: + # Failed to load user hive + pass + + # Get Shell folder sizes + key = r'{SID}\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders'.format(**users[u]) + try: + with winreg.OpenKey(winreg.HKEY_USERS, key) as _key: + for folder in SHELL_FOLDERS.keys(): + for value in SHELL_FOLDERS[folder]: + try: + # Query value and break out of for look if successful + folder_path = winreg.QueryValueEx(_key, value)[0] + try: + # Finally calculate folder size + out = run_program(du, ['-nobanner', '-q', folder_path]) + size = out.stdout.decode().splitlines()[4] + size = re.sub(r'Size:\s+([\d,]+)\sbytes$', r'\1', size) + size = size.replace(',', '') + size = human_readable_size(size) + str = '{folder:<20} {size:>10} ({path})'.format(folder=folder, size=size, path=folder_path) + users[u]['Shell Folders'][folder] = str + except subprocess.CalledProcessError: + # Failed to get folder size + pass + break + except FileNotFoundError: + # Failed to query value above + pass + except FileNotFoundError: + # Can't read the user hive, skipping this user. + pass + + # Extra shell folder check + for folder in SHELL_FOLDERS.keys(): + if folder not in users[u]['Shell Folders']: + folder_path = '{ProfileImagePath}\\{folder}'.format(folder=folder, **users[u]) + if os.path.exists(folder_path): + try: + out = run_program(du, ['-nobanner', '-q', folder_path]) + size = out.stdout.decode().splitlines()[4] + size = re.sub(r'Size:\s+([\d,]+)\sbytes$', r'\1', size) + size = size.replace(',', '') + size = human_readable_size(size) + str = '{folder:<20} {size:>10} ({path})'.format(folder=folder, size=size, path=folder_path) + users[u]['Shell Folders'][folder] = str + except subprocess.CalledProcessError: + # Failed to get folder size + pass + + # Extra folder sizes + for folder in EXTRA_FOLDERS: + folder_path = '{ProfileImagePath}\\{folder}'.format(folder=folder, **users[u]) + if os.path.exists(folder_path): + try: + out = run_program(du, ['-nobanner', '-q', folder_path]) + size = size.stdout.decode().splitlines()[4] + size = re.sub(r'Size:\s+([\d,]+)\sbytes$', r'\1', size) + size = size.replace(',', '') + size = human_readable_size(size) + str = '{folder:<20} {size:>10} ({path})'.format(folder=folder, size=size, path=folder_path) + users[u]['Extra Folders'][folder] = str + except subprocess.CalledProcessError: + # Failed to get folder size + pass + # Unload user hive (if necessary) + if unload_hive: + _cmd = 'reg unload {tmp_path}'.format(tmp_path=TMP_HIVE_PATH) + run_program(_cmd, check=False) + + except FileNotFoundError: + # Can't find the ProfileImagePath, skipping this user. + pass + except: + # Unload the wk_tmp hive no matter what + _cmd = 'reg unload {tmp_path}'.format(tmp_path=TMP_HIVE_PATH) + run_program(_cmd, check=False) + # Done + return users + def human_readable_size(size, decimals=0): """Convert size in bytes to a human-readable format and return a str.""" # Prep string formatting @@ -677,6 +888,70 @@ def select_windows_version(): def sleep(seconds=2): time.sleep(seconds) +def stay_awake(vars_wk=None): + """Prevent the system from sleeping or hibernating.""" + if vars_wk is None: + raise Exception + # Bail if caffeine is already running + for proc in psutil.process_iter(): + if proc.name() == 'caffeine.exe': + return + # Extract and run + extract_item('caffeine', vars_wk, silent=True) + try: + subprocess.Popen('"{BinDir}\\caffeine\\caffeine.exe"'.format(**vars_wk)) + except: + print_error('ERROR: No caffeine available; please set the power setting to High Performace.') + +def upload_data(path=None, file=None, vars_wk=None): + """Add CLIENT_INFO_SERVER to authorized connections and upload file.""" + # Bail early + if path is None or file is None or vars_wk is None: + raise Exception + + extract_item('PuTTY', vars_wk, filter='WK.ppk psftp.exe', silent=True) + + # Authorize connection to the server + winreg.CreateKey(winreg.HKEY_CURRENT_USER, r'Software\SimonTatham\PuTTY\SshHostKeys') + with winreg.OpenKey(winreg.HKEY_CURRENT_USER, r'Software\SimonTatham\PuTTY\SshHostKeys', access=winreg.KEY_WRITE) as _key: + winreg.SetValueEx(_key, 'rsa2@22:10.0.0.10', 0, winreg.REG_SZ, r'0x10001,0xf60757b7656263622b3c17b2ec1a9bd74c555fe927b5e571928007cf944a98113db2434a33c782e8b51447ceb7cd0b30475f0d988ef23af75a5b48eaa8edad478489b314837fd5134a8059084ae6bafdb4a3eb759afad7474027c81773dc233ea4c4e46f6f5b32a58672b0e541613ac6eb231715fd5ffc28f237b66ef9ed18deff232e83acc1ecdf10794d11344ac68035d48d0bcc0c83f76b1fe9d5d16bb46d9906ce4e0214ba03cec411b2801a238e891e3eedc7ed4b41a81f0e228c0a4b7efedad8c10b982d01098628f8c4e3166e0b3a19fef11dc8600ceedbd19d6844d5e9c7147b4f64ec58b04dd9fb571a0909d2847894fbf9694415eb89df0a2b6fb1') + + # Write batch file + with open('{TmpDir}\\psftp.batch'.format(**vars_wk), 'w', encoding='ascii') as f: + f.write('lcd "{path}"\n'.format(path=path)) + f.write('cd "{Share}"\n'.format(**CLIENT_INFO_SERVER)) + f.write('put "{file}"\n'.format(file=file)) + + # Upload Info + _cmd = [ + '{BinDir}\\PuTTY\\PSFTP.EXE'.format(**vars_wk), + '-noagent', + '-i', '{BinDir}\\PuTTY\WK.ppk'.format(**vars_wk), + '{User}@{IP}'.format(**CLIENT_INFO_SERVER), + '-b', '{TmpDir}\\psftp.batch'.format(**vars_wk)] + run_program(_cmd) + +def wait_for_process(name=None): + """Wait for process by name.""" + if name is None: + raise Exception + _still_running = True + while _still_running: + sleep(1) + _still_running = False + for proc in psutil.process_iter(): + if re.search(r'^{name}'.format(name=name), proc.name(), re.IGNORECASE): + _still_running = True + sleep(1) + +def kill_process(name=None): + """Kill any running caffeine.exe processes.""" + if name is None: + raise Exception + for proc in psutil.process_iter(): + if proc.name() == name: + proc.kill() + def umount_backup_shares(): """Unnount the backup shares regardless of current status.""" for server in BACKUP_SERVERS: @@ -690,7 +965,7 @@ def umount_backup_shares(): time.sleep(1) # Init functions -def init_vars(): +def init_vars_wk(): """Sets common variables and returns a dict.""" print('Initializing...') # Find base path @@ -716,10 +991,13 @@ def init_vars(): 'Date-Time': time.strftime("%Y-%m-%d_%H%M_%z"), 'Env': os.environ.copy() } - _vars['BinDir'] = '{BaseDir}\\.bin'.format(**_vars) - _vars['ClientDir'] = '{SYSTEMDRIVE}\\WK'.format(**_vars['Env']) - _vars['LogDir'] = '{ClientDir}\\Info\\{Date}'.format(**_vars) - _vars['TmpDir'] = '{BinDir}\\tmp'.format(**_vars) + _vars['ArchivePassword'] = ARCHIVE_PASSWORD + _vars['BinDir'] = '{BaseDir}\\.bin'.format(**_vars) + _vars['CBinDir'] = '{BaseDir}\\.cbin'.format(**_vars) + _vars['ClientDir'] = '{SYSTEMDRIVE}\\WK'.format(**_vars['Env']) + _vars['LogDir'] = '{ClientDir}\\Info\\{Date}'.format(**_vars) + _vars['TmpDir'] = '{BinDir}\\tmp'.format(**_vars) + os.makedirs(_vars['TmpDir'], exist_ok=True) return _vars @@ -771,6 +1049,7 @@ def init_vars_os(): if _vars_os['CurrentBuild'] == 14393: _vars_os['Name'] += ' Release 1607 "Redstone 1" / "Anniversary Update"' _vars_os['Name'] = _vars_os['Name'].replace('Service Pack ', 'SP') + _vars_os['Name'] = _vars_os['Name'].replace('Unknown Release', 'Release') _vars_os['Name'] = re.sub(r'\s+', ' ', _vars_os['Name']) # == vista == # 6.0.6000 @@ -804,7 +1083,7 @@ def init_vars_os(): if _vars_os['SafeMode']: _vars_os['Activation'] = 'Activation status unavailable in safe mode' else: - _out = run_program('cscript /nologo {WINDIR}\\System32\\slmgr.vbs /xpr'.format(**_env)) + _out = run_program('cscript /nologo {SYSTEMROOT}\\System32\\slmgr.vbs /xpr'.format(**_env)) _out = _out.stdout.decode().splitlines() _out = [l for l in _out if re.match(r'^\s', l)] if len(_out) > 0: diff --git a/.bin/Scripts/gen_office.bash b/.bin/Scripts/gen_office.bash new file mode 100644 index 00000000..8fe8aede --- /dev/null +++ b/.bin/Scripts/gen_office.bash @@ -0,0 +1,135 @@ +#!/bin/bash + +cd ../../ +mkdir Installers/Extras/Office -p +pushd Installers/Extras/Office +mkdir 2007 +mkdir 2010 +mkdir 2013 +mkdir 2016 + +cp ../../../.bin/Scripts/Launcher_Template.cmd "2007/2007 Microsoft Office system (SP3).cmd" +sed -ir 's/__TYPE__/Office/' "2007/2007 Microsoft Office system (SP3).cmd" +sed -ir 's/__PATH__/2007/' "2007/2007 Microsoft Office system (SP3).cmd" +sed -ir 's/__ITEM__/2007 Microsoft Office system (SP3)/' "2007/2007 Microsoft Office system (SP3).cmd" + +cp ../../../.bin/Scripts/Launcher_Template.cmd "2007/Access 2007 (SP3).cmd" +sed -ir 's/__TYPE__/Office/' "2007/Access 2007 (SP3).cmd" +sed -ir 's/__PATH__/2007/' "2007/Access 2007 (SP3).cmd" +sed -ir 's/__ITEM__/Access 2007 (SP3)/' "2007/Access 2007 (SP3).cmd" + +cp ../../../.bin/Scripts/Launcher_Template.cmd "2007/AccessRuntime2007.cmd" +sed -ir 's/__TYPE__/Office/' "2007/AccessRuntime2007.cmd" +sed -ir 's/__PATH__/2007/' "2007/AccessRuntime2007.cmd" +sed -ir 's/__ITEM__/AccessRuntime2007.exe/' "2007/AccessRuntime2007.cmd" + +cp ../../../.bin/Scripts/Launcher_Template.cmd "2007/Home and Student 2007 (SP3).cmd" +sed -ir 's/__TYPE__/Office/' "2007/Home and Student 2007 (SP3).cmd" +sed -ir 's/__PATH__/2007/' "2007/Home and Student 2007 (SP3).cmd" +sed -ir 's/__ITEM__/Home and Student 2007 (SP3)/' "2007/Home and Student 2007 (SP3).cmd" + +cp ../../../.bin/Scripts/Launcher_Template.cmd "2007/Outlook 2007 (SP3).cmd" +sed -ir 's/__TYPE__/Office/' "2007/Outlook 2007 (SP3).cmd" +sed -ir 's/__PATH__/2007/' "2007/Outlook 2007 (SP3).cmd" +sed -ir 's/__ITEM__/Outlook 2007 (SP3)/' "2007/Outlook 2007 (SP3).cmd" + +cp ../../../.bin/Scripts/Launcher_Template.cmd "2007/Professional 2007 (SP3).cmd" +sed -ir 's/__TYPE__/Office/' "2007/Professional 2007 (SP3).cmd" +sed -ir 's/__PATH__/2007/' "2007/Professional 2007 (SP3).cmd" +sed -ir 's/__ITEM__/Professional 2007 (SP3)/' "2007/Professional 2007 (SP3).cmd" + +cp ../../../.bin/Scripts/Launcher_Template.cmd "2007/Publisher 2007 (SP3).cmd" +sed -ir 's/__TYPE__/Office/' "2007/Publisher 2007 (SP3).cmd" +sed -ir 's/__PATH__/2007/' "2007/Publisher 2007 (SP3).cmd" +sed -ir 's/__ITEM__/Publisher 2007 (SP3)/' "2007/Publisher 2007 (SP3).cmd" + +cp ../../../.bin/Scripts/Launcher_Template.cmd "2007/Small Business 2007 (SP3).cmd" +sed -ir 's/__TYPE__/Office/' "2007/Small Business 2007 (SP3).cmd" +sed -ir 's/__PATH__/2007/' "2007/Small Business 2007 (SP3).cmd" +sed -ir 's/__ITEM__/Small Business 2007 (SP3)/' "2007/Small Business 2007 (SP3).cmd" + +cp ../../../.bin/Scripts/Launcher_Template.cmd "2010/Outlook 2010 (SP2) (x32).cmd" +sed -ir 's/__TYPE__/Office/' "2010/Outlook 2010 (SP2) (x32).cmd" +sed -ir 's/__PATH__/2010/' "2010/Outlook 2010 (SP2) (x32).cmd" +sed -ir 's/__ITEM__/Outlook 2010 (SP2) (x32)/' "2010/Outlook 2010 (SP2) (x32).cmd" + +cp ../../../.bin/Scripts/Launcher_Template.cmd "2010/Outlook 2010 (SP2) (x64).cmd" +sed -ir 's/__TYPE__/Office/' "2010/Outlook 2010 (SP2) (x64).cmd" +sed -ir 's/__PATH__/2010/' "2010/Outlook 2010 (SP2) (x64).cmd" +sed -ir 's/__ITEM__/Outlook 2010 (SP2) (x64)/' "2010/Outlook 2010 (SP2) (x64).cmd" + +cp ../../../.bin/Scripts/Launcher_Template.cmd "2010/Professional Plus 2010 (SP2).cmd" +sed -ir 's/__TYPE__/Office/' "2010/Professional Plus 2010 (SP2).cmd" +sed -ir 's/__PATH__/2010/' "2010/Professional Plus 2010 (SP2).cmd" +sed -ir 's/__ITEM__/Professional Plus 2010 (SP2)/' "2010/Professional Plus 2010 (SP2).cmd" + +cp ../../../.bin/Scripts/Launcher_Template.cmd "2010/Publisher 2010 (SP2).cmd" +sed -ir 's/__TYPE__/Office/' "2010/Publisher 2010 (SP2).cmd" +sed -ir 's/__PATH__/2010/' "2010/Publisher 2010 (SP2).cmd" +sed -ir 's/__ITEM__/Publisher 2010 (SP2)/' "2010/Publisher 2010 (SP2).cmd" + +cp ../../../.bin/Scripts/Launcher_Template.cmd "2010/Single Image 2010 (SP2).cmd" +sed -ir 's/__TYPE__/Office/' "2010/Single Image 2010 (SP2).cmd" +sed -ir 's/__PATH__/2010/' "2010/Single Image 2010 (SP2).cmd" +sed -ir 's/__ITEM__/Single Image 2010 (SP2)/' "2010/Single Image 2010 (SP2).cmd" + +cp ../../../.bin/Scripts/Launcher_Template.cmd "2013/Home and Business 2013 (x64).cmd" +sed -ir 's/__TYPE__/Office/' "2013/Home and Business 2013 (x64).cmd" +sed -ir 's/__PATH__/2013/' "2013/Home and Business 2013 (x64).cmd" +sed -ir 's/__ITEM__/hb_64.xml/' "2013/Home and Business 2013 (x64).cmd" + +cp ../../../.bin/Scripts/Launcher_Template.cmd "2013/Home and Student 2013 (x64).cmd" +sed -ir 's/__TYPE__/Office/' "2013/Home and Student 2013 (x64).cmd" +sed -ir 's/__PATH__/2013/' "2013/Home and Student 2013 (x64).cmd" +sed -ir 's/__ITEM__/hs_64.xml/' "2013/Home and Student 2013 (x64).cmd" + +cp ../../../.bin/Scripts/Launcher_Template.cmd "2013/Office 365 2013 (x64).cmd" +sed -ir 's/__TYPE__/Office/' "2013/Office 365 2013 (x64).cmd" +sed -ir 's/__PATH__/2013/' "2013/Office 365 2013 (x64).cmd" +sed -ir 's/__ITEM__/365_64.xml/' "2013/Office 365 2013 (x64).cmd" + +cp ../../../.bin/Scripts/Launcher_Template.cmd "2013/Home and Business 2013 (x32).cmd" +sed -ir 's/__TYPE__/Office/' "2013/Home and Business 2013 (x32).cmd" +sed -ir 's/__PATH__/2013/' "2013/Home and Business 2013 (x32).cmd" +sed -ir 's/__ITEM__/hb_32.xml/' "2013/Home and Business 2013 (x32).cmd" + +cp ../../../.bin/Scripts/Launcher_Template.cmd "2013/Home and Student 2013 (x32).cmd" +sed -ir 's/__TYPE__/Office/' "2013/Home and Student 2013 (x32).cmd" +sed -ir 's/__PATH__/2013/' "2013/Home and Student 2013 (x32).cmd" +sed -ir 's/__ITEM__/hs_32.xml/' "2013/Home and Student 2013 (x32).cmd" + +cp ../../../.bin/Scripts/Launcher_Template.cmd "2013/Office 365 2013 (x32).cmd" +sed -ir 's/__TYPE__/Office/' "2013/Office 365 2013 (x32).cmd" +sed -ir 's/__PATH__/2013/' "2013/Office 365 2013 (x32).cmd" +sed -ir 's/__ITEM__/365_32.xml/' "2013/Office 365 2013 (x32).cmd" + +cp ../../../.bin/Scripts/Launcher_Template.cmd "2016/Home and Business 2016 (x64).cmd" +sed -ir 's/__TYPE__/Office/' "2016/Home and Business 2016 (x64).cmd" +sed -ir 's/__PATH__/2016/' "2016/Home and Business 2016 (x64).cmd" +sed -ir 's/__ITEM__/hb_64.xml/' "2016/Home and Business 2016 (x64).cmd" + +cp ../../../.bin/Scripts/Launcher_Template.cmd "2016/Home and Student 2016 (x64).cmd" +sed -ir 's/__TYPE__/Office/' "2016/Home and Student 2016 (x64).cmd" +sed -ir 's/__PATH__/2016/' "2016/Home and Student 2016 (x64).cmd" +sed -ir 's/__ITEM__/hs_64.xml/' "2016/Home and Student 2016 (x64).cmd" + +cp ../../../.bin/Scripts/Launcher_Template.cmd "2016/Office 365 2016 (x64).cmd" +sed -ir 's/__TYPE__/Office/' "2016/Office 365 2016 (x64).cmd" +sed -ir 's/__PATH__/2016/' "2016/Office 365 2016 (x64).cmd" +sed -ir 's/__ITEM__/365_64.xml/' "2016/Office 365 2016 (x64).cmd" + +cp ../../../.bin/Scripts/Launcher_Template.cmd "2016/Home and Business 2016 (x32).cmd" +sed -ir 's/__TYPE__/Office/' "2016/Home and Business 2016 (x32).cmd" +sed -ir 's/__PATH__/2016/' "2016/Home and Business 2016 (x32).cmd" +sed -ir 's/__ITEM__/hb_32.xml/' "2016/Home and Business 2016 (x32).cmd" + +cp ../../../.bin/Scripts/Launcher_Template.cmd "2016/Home and Student 2016 (x32).cmd" +sed -ir 's/__TYPE__/Office/' "2016/Home and Student 2016 (x32).cmd" +sed -ir 's/__PATH__/2016/' "2016/Home and Student 2016 (x32).cmd" +sed -ir 's/__ITEM__/hs_32.xml/' "2016/Home and Student 2016 (x32).cmd" + +cp ../../../.bin/Scripts/Launcher_Template.cmd "2016/Office 365 2016 (x32).cmd" +sed -ir 's/__TYPE__/Office/' "2016/Office 365 2016 (x32).cmd" +sed -ir 's/__PATH__/2016/' "2016/Office 365 2016 (x32).cmd" +sed -ir 's/__ITEM__/365_32.xml/' "2016/Office 365 2016 (x32).cmd" +popd \ No newline at end of file diff --git a/.bin/Scripts/init.ps1 b/.bin/Scripts/init.ps1 deleted file mode 100644 index 6d8a1a08..00000000 --- a/.bin/Scripts/init.ps1 +++ /dev/null @@ -1,134 +0,0 @@ -# Wizard Kit: Common settings and functions - -$host.UI.RawUI.BackgroundColor = "black" -$host.UI.RawUI.ForegroundColor = "green" -$safemode = $false -if ((gwmi win32_computersystem -Property BootupState).BootupState -imatch 'Fail-safe') { - $safemode = $true -} -$appdata = (gci env:appdata).value -$localappdata = (gci env:localappdata).value -$username = (gci env:username).value -$userprofile = (gci env:userprofile).value -$systemdrive = (gci env:systemdrive).value -$windir = (gci env:windir).value -$programdata = (gci env:programdata).value -$programfiles = (gci env:programfiles).value -$programfiles86 = $programfiles -if (test-path env:"programfiles(x86)") { - $programfiles86 = (gci env:"programfiles(x86)").value -} -$ClientPath = "$systemdrive\WK" -$date = get-date -uformat "%Y-%m-%d" -$date_time = get-date -uformat "%Y-%m-%d_%H%M" -$logpath = "$ClientPath\Info\$date" - -function ask { - param([string]$text = "Kotaero", [string]$log = "WK.log") - $answered = $false - $text += " [Y/N]" - while (!$answered) { - $answer = read-host $text - if ($answer -imatch '^(y|yes)$') { - $answer = $true - $answered = $true - } elseif ($answer -imatch '^(n|no)$') { - $answer = $false - $answered = $true - } - } - $text += ": $answer" - out-file -filepath $log -inputobject $text -append - return $answer -} -function WK-error { - param([string]$text = "ERROR", [string]$log = "WK.log") - write-host ($text) -foreground "red" - out-file -filepath $log -inputobject $text -append -} -function WK-warn { - param([string]$text = "WARNING", [string]$log = "WK.log") - write-host ($text) -foreground "yellow" - out-file -filepath $log -inputobject $text -append -} -function WK-write { - param([string]$text = "", [string]$log = "WK.log") - write-host ($text) - out-file -filepath $log -inputobject $text -append -} -function menu-select { - ## $MainItems should be an "AoH" object (with at least the key "Name" for each item) - ## NOTE: if the CRLF=$true; then a spacer is added before that entry. - ## Example: - ## $MainItems = @( - ## @{Name="Windows 10 Home"; ImageFile="Win10"; ImageName="Windows 10 Home"} - ## @{Name="Windows 10 Pro"; ImageFile="Win10"; ImageName="Windows 10 Pro"} - ##) - - ## $ActionItems should be an "AoH" object (with at least the keys "Name" and "Letter" for each item) - ## NOTE: if the CRLF=$true; then a spacer is added before that entry. - ## Example: - ## $ActionItems = @( - ## @{Name="Reboot"; Letter="R"} - ## @{Name="Shutdown"; Letter="S"} - ##) - - param( - [string]$Title = "## Untitled Menu ##", - [string]$Prompt = "Please make a selection", - $MainItems = @(), - $ActionItems = @() - ) - - # Bail early if no items given - if ($MainItems.length -eq 0 -and $ActionItems.length -eq 0) { - throw "MenuError: No items given." - } - - # Build menu - $menu_splash = "{0}`r`n`r`n" -f $title - $valid_answers = @() - - # Add main items to splash - if ($MainItems.length -gt 0) { - for ($i=0; $i -lt $MainItems.length; $i++) { - if ($MainItems[$i].CRLF) { - # Add spacer - $menu_splash += "`r`n" - } - $valid_answers += ($i + 1) - $menu_splash += "{0,2:N0}: {1}`r`n" -f ($i + 1), $MainItems[$i].Name - } - $menu_splash += "`r`n" - $menu_splash += "`r`n" - } - - # Add action items to splash - if ($ActionItems.length -gt 0) { - foreach ($_item in $ActionItems) { - if ($_item.CRLF) { - # Add spacer - $menu_splash += "`r`n" - } - $menu_splash += "{0}: {1}`r`n" -f $_item.Letter.ToUpper(), $_item.Name - $valid_answers += $_item.Letter.ToLower(), $_item.Letter.ToUpper() - } - $menu_splash += "`r`n" - } - - # Add prompt to splash - $menu_splash += "{0}`r`n" -f $prompt - - # Select - do { - clear - $answer = read-host -prompt $menu_splash - } until ($valid_answers -contains $answer) - - return $answer.ToUpper() -} -function pause { - param([string]$message = "Press Enter to continue... ") - write-host $message - $x = read-host -} diff --git a/.bin/Scripts/init_client_dir.cmd b/.bin/Scripts/init_client_dir.cmd index 461e95c8..61462943 100644 --- a/.bin/Scripts/init_client_dir.cmd +++ b/.bin/Scripts/init_client_dir.cmd @@ -1,6 +1,7 @@ -:: Wizard Kit: Create Info folder using current date +:: Wizard Kit: Create client_dir folder(s) @echo off +if defined DEBUG (@echo on) :Flags set _backups= diff --git a/.bin/Scripts/install_sw_bundle.py b/.bin/Scripts/install_sw_bundle.py index 0b8f552e..37298af6 100644 --- a/.bin/Scripts/install_sw_bundle.py +++ b/.bin/Scripts/install_sw_bundle.py @@ -7,23 +7,28 @@ import re os.chdir(os.path.dirname(os.path.realpath(__file__))) os.system('title Wizard Kit: SW Bundle Tool') from functions import * -vars = init_vars() -vars_os = init_vars_os() +vars_wk = init_vars_wk() +vars_wk.update(init_vars_os()) if __name__ == '__main__': + stay_awake(vars_wk) + errors = False + # Adobe Reader - if vars_os['Version'] != 'Vista': + if vars_wk['Version'] != 'Vista': print('Installing Adobe Reader DC...') - _prog = '{BaseDir}/Installers/Extras/Office/Adobe Reader DC.exe'.format(**vars) + _prog = '{BaseDir}/Installers/Extras/Office/Adobe Reader DC.exe'.format(**vars_wk) _args = ['/sAll', '/msi', '/norestart', '/quiet', 'ALLUSERS=1', 'EULA_ACCEPT=YES'] try: run_program(_prog, _args) except: print_error('Failed to install Adobe Reader DC') + errors = True # Visual C++ Redists print('Installing Visual C++ Runtimes...') - os.chdir('{BinDir}/_vcredists'.format(**vars)) + extract_item('_vcredists', vars_wk, silent=True) + os.chdir('{BinDir}/_vcredists'.format(**vars_wk)) _redists = [ # 2005 {'Prog': 'msiexec', @@ -61,19 +66,22 @@ if __name__ == '__main__': run_program(vcr['Prog'], vcr['Args'], check=False) except: print_error('Failed to install {}'.format(vcr['Prog'])) + errors = True # Main Bundle - if vars_os['Version'] in ['Vista', '7']: + if vars_wk['Version'] in ['Vista', '7']: # Legacy selection if ask('Install MSE?'): - _prog = '{BaseDir}/Installers/Extras/Security/Microsoft Security Essentials.exe'.format(**vars) - run_program(_prog, check=False) - _prog = '{BaseDir}/Installers/Extras/Bundles/Legacy.exe'.format(**vars) - run_program(_prog, check=False) - elif vars_os['Version'] in ['8', '10']: + _prog = '{BaseDir}/Installers/Extras/Security/Microsoft Security Essentials.exe'.format(**vars_wk) + subprocess.Popen(_prog) + _prog = '{BaseDir}/Installers/Extras/Bundles/Legacy.exe'.format(**vars_wk) + subprocess.Popen(_prog) + elif vars_wk['Version'] in ['8', '10']: # Modern selection - _prog = '{BaseDir}/Installers/Extras/Bundles/Modern.exe'.format(**vars) - run_program(_prog, check=False) + _prog = '{BaseDir}/Installers/Extras/Bundles/Modern.exe'.format(**vars_wk) + subprocess.Popen(_prog) - pause("Press Enter to exit...") + if errors: + pause("Press Enter to exit...") + kill_process('caffeine.exe') quit() diff --git a/.bin/Scripts/installed_ram.ps1 b/.bin/Scripts/installed_ram.ps1 deleted file mode 100644 index cf7e9245..00000000 --- a/.bin/Scripts/installed_ram.ps1 +++ /dev/null @@ -1,44 +0,0 @@ -# Wizard Kit: List installed RAM (and speed if possible) - -param([string]$log) - -cd $(Split-Path $MyInvocation.MyCommand.Path) -. .\init.ps1 - -$ram_speeds = @{ - "100" = "DDR-200 (PC-1600)"; - "133" = "DDR-266 (PC-2100)"; - "134" = "DDR-266 (PC-2100)"; - "166" = "DDR-333 (PC-2700)"; - "167" = "DDR-333 (PC-2700)"; - "200" = "[DDR|DDR2]-400 ([PC|PC2]-3200)"; - "266" = "DDR2-533 (PC2-4200)"; - "267" = "DDR2-533 (PC2-4200)"; - "333" = "DDR2-667 (PC2-5300)"; - "334" = "DDR2-667 (PC2-5300)"; - "400" = "[DDR2|DDR3]-800 ([PC2|PC3]-6400)"; - "533" = "[DDR2|DDR3]-1066 ([PC2|PC3]-8500)"; - "534" = "[DDR2|DDR3]-1066 ([PC2|PC3]-8500)"; - "666" = "DDR3-1333 (PC3-10600)"; - "667" = "DDR3-1333 (PC3-10600)"; - "800" = "[DDR3|DDR4]-1600 (PC3-12800 / PC4-1600)"; - "933" = "[DDR3|DDR4]-1866 (PC3-14900 / PC4-1866)"; - "934" = "[DDR3|DDR4]-1866 (PC3-14900 / PC4-1866)"; - "1066" = "[DDR3|DDR4]-2133 (PC3-17000 / PC4-2133)"; - "1067" = "[DDR3|DDR4]-2133 (PC3-17000 / PC4-2133)"; - "1200" = "DDR4-2400 (PC4-2400)"; -} - -$cs = Get-WmiObject -Class Win32_ComputerSystem -$mem = Get-WmiObject -Class Win32_PhysicalMemory -$total = 0 -foreach ($dev in $mem) { - $_size = $dev.Capacity/1gb - $_loc = $dev.DeviceLocator - $_type = $ram_speeds."$($dev.Speed)" - WK-write $(" {0:N2} Gb ({1}) {2}" -f $_size,$_loc,$_type) "$log" - $total += $dev.Capacity -} -WK-write " -------" "$log" -WK-write $(" {0:N2} Gb Usable" -f $($cs.TotalPhysicalMemory/1gb)) "$log" -WK-write $(" {0:N2} Gb Installed" -f $($total/1gb)) "$log" diff --git a/.bin/Scripts/menu.py b/.bin/Scripts/menu.py deleted file mode 100644 index ddb1066b..00000000 --- a/.bin/Scripts/menu.py +++ /dev/null @@ -1,368 +0,0 @@ -# Wizard Kit: Menu - -import os -import re -import subprocess -import time -import traceback -import winreg - -from functions import * - -# Init -os.chdir(os.path.dirname(os.path.realpath(__file__))) -bin = os.path.abspath('..\\') -## Check bootup type -BOOT_TYPE = 'Legacy' -try: - reg_key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, 'System\\CurrentControlSet\\Control') - reg_value = winreg.QueryValueEx(reg_key, 'PEFirmwareType')[0] - if reg_value == 2: - BOOT_TYPE = 'UEFI' -except: - BOOT_TYPE = 'Unknown' - -class AbortException(Exception): - pass - -def abort_to_main_menu(message='Returning to main menu...'): - print_warning(message) - pause('Press Enter to return to main menu... ') - raise AbortException - -def menu_backup_imaging(): - """Take backup images of partition(s) in the WIM format and save them to a backup share""" - - # Mount backup shares - os.system('cls') - mount_backup_shares() - - # Set ticket number - ticket = None - while ticket is None: - tmp = input('Enter ticket number: ') - if re.match(r'^([0-9]+([-_]?\w+|))$', tmp): - ticket = tmp - - # Select disk to backup - disk = select_disk('For which drive are we creating backups?') - if disk is None: - abort_to_main_menu() - - # Get list of partitions that can't be imaged - bad_parts = [p['Number'] for p in disk['Partitions'] if 'Letter' not in p or re.search(r'(RAW|Unknown)', p['FileSystem'])] - - # Bail if no partitions are found (that can be imaged) - num_parts = len(disk['Partitions']) - if num_parts == 0 or num_parts == len(bad_parts): - abort_to_main_menu(' No partitions can be imaged for the selected drive') - - # Select destination - dest = select_destination() - if dest is None: - abort_to_main_menu('Aborting Backup Creation') - - # List (and update) partition details for selected drive - os.system('cls') - print('Create Backup - Details:\n') - print(' Drive: {Size}\t[{Table}] ({Type}) {Name}\n'.format(**disk)) - clobber_risk = 0 - width=len(str(len(disk['Partitions']))) - for par in disk['Partitions']: - # Detail each partition - if par['Number'] in bad_parts: - print_warning(' * Partition {Number:>{width}}:\t{Size} {FileSystem}\t\t{q}{Name}{q}\t{Description} ({OS})'.format( - width=width, - q='"' if par['Name'] != '' else '', - **par)) - else: - # Update info for WIM capture - par['ImageName'] = str(par['Name']) - if par['ImageName'] == '': - par['ImageName'] = 'Unknown' - if 'IP' in dest: - par['ImagePath'] = '\\\\{IP}\\{Share}\\{ticket}'.format(ticket=ticket, **dest) - else: - par['ImagePath'] = '{Letter}:\\{ticket}'.format(ticket=ticket, **dest) - par['ImageFile'] = '{Number}_{ImageName}'.format(**par) - par['ImageFile'] = '{fixed_name}.wim'.format(fixed_name=re.sub(r'\W', '_', par['ImageFile'])) - - # Check for existing backups - par['ImageExists'] = False - if os.path.exists('{ImagePath}\\{ImageFile}'.format(**par)): - par['ImageExists'] = True - clobber_risk += 1 - print_info(' + Partition {Number:>{width}}:\t{Size} {FileSystem} (Used: {Used Space})\t{q}{Name}{q}'.format( - width=width, - q='"' if par['Name'] != '' else '', - **par)) - else: - print(' Partition {Number:>{width}}:\t{Size} {FileSystem} (Used: {Used Space})\t{q}{Name}{q}'.format( - width=width, - q='"' if par['Name'] != '' else '', - **par)) - print('') # Spacer - - # Add warning about partition(s) that will be skipped - if len(bad_parts) > 1: - print_warning(' * Unable to backup these partitions') - elif len(bad_parts) == 1: - print_warning(' * Unable to backup this partition') - if clobber_risk > 1: - print_info(' + These partitions already have backup images on {Display Name}:'.format(**dest)) - elif clobber_risk == 1: - print_info(' + This partition already has a backup image on {Display Name}:'.format(**dest)) - if clobber_risk + len(bad_parts) > 1: - print_warning('\nIf you continue the partitions marked above will NOT be backed up.\n') - if clobber_risk + len(bad_parts) == 1: - print_warning('\nIf you continue the partition marked above will NOT be backed up.\n') - - # (re)display the destination - print(' Destination:\t{name}\n'.format(name=dest.get('Display Name', dest['Name']))) - - # Ask to proceed - if (not ask('Proceed with backup?')): - abort_to_main_menu('Aborting Backup Creation') - - # Backup partition(s) - print('\n\nStarting task.\n') - errors = False - for par in disk['Partitions']: - print(' Partition {Number} Backup...\t\t'.format(**par), end='', flush=True) - if par['Number'] in bad_parts: - print_warning('Skipped.') - else: - cmd = '{bin}\\wimlib\\wimlib-imagex capture {Letter}:\\ "{ImagePath}\\{ImageFile}" "{ImageName}" "{ImageName}" --compress=fast'.format(bin=bin, **par) - if par['ImageExists']: - print_warning('Skipped.') - else: - try: - os.makedirs('{ImagePath}'.format(**par), exist_ok=True) - run_program(cmd) - print_success('Complete.') - except subprocess.CalledProcessError as err: - print_error('Failed.') - errors = True - par['Error'] = err.stderr.decode().splitlines() - - # Verify backup(s) - if len(par) - len(bad_parts) > 1: - print('\n\n Verifying backups\n') - else: - print('\n\n Verifying backup\n') - for par in disk['Partitions']: - if par['Number'] not in bad_parts: - print(' Partition {Number} Image...\t\t'.format(**par), end='', flush=True) - cmd = '{bin}\\wimlib\\wimlib-imagex verify "{ImagePath}\\{ImageFile}" --nocheck'.format(bin=bin, **par) - if not os.path.exists('{ImagePath}\\{ImageFile}'.format(**par)): - print_error('Missing.') - else: - try: - run_program(cmd) - print_success('OK.') - except subprocess.CalledProcessError as err: - print_error('Damaged.') - errors = True - par['Error'] = par.get('Error', []) + err.stderr.decode().splitlines() - - # Print summary - if errors: - print_warning('\nErrors were encountered and are detailed below.') - for par in [p for p in disk['Partitions'] if 'Error' in p]: - print(' Partition {Number} Error:'.format(**par)) - for line in par['Error']: - line = line.strip() - if line != '': - print_error('\t{line}'.format(line=line)) - time.sleep(300) - else: - print_success('\nNo errors were encountered during imaging.') - time.sleep(10) - pause('\nPress Enter to return to main menu... ') - -def menu_windows_setup(): - """Format a drive, partition for MBR or GPT, apply a Windows image, and rebuild the boot files""" - - # Select the version of Windows to apply - os.system('cls') - selected_windows_version = select_windows_version() - if selected_windows_version is None: - abort_to_main_menu('Aborting Windows setup') - - # Find Windows image - image = find_windows_image(selected_windows_version['ImageFile']) - if not any(image): - print_error('Failed to find Windows source image for {winver}'.format(winver=selected_windows_version['Name'])) - abort_to_main_menu('Aborting Windows setup') - - # Select drive to use as the OS drive - dest_drive = select_disk('To which drive are we installing Windows?') - if dest_drive is None: - abort_to_main_menu('Aborting Windows setup') - - # Confirm drive format - print_warning('All data will be deleted from the following drive:') - print_warning('\t{Size}\t({Table}) {Name}'.format(**dest_drive)) - if (not ask('Is this correct?')): - abort_to_main_menu('Aborting Windows setup') - - # MBR/Legacy or GPT/UEFI? - use_gpt = True - if (BOOT_TYPE == 'UEFI'): - if (not ask("Setup drive using GPT (UEFI) layout?")): - use_gpt = False - else: - if (ask("Setup drive using MBR (legacy) layout?")): - use_gpt = False - - # Safety check - print_warning('SAFETY CHECK\n') - print_error(' FORMATTING:\tDrive: {Size}\t[{Table}] ({Type}) {Name}'.format(**dest_drive)) - if len(dest_drive['Partitions']) > 0: - width=len(str(len(dest_drive['Partitions']))) - for par in dest_drive['Partitions']: - if 'Letter' not in par or re.search(r'(RAW)', par['FileSystem']): - print_error('\t\tPartition {Number:>{width}}:\t{Size} {q}{Name}{q} ({FileSystem})\t\t{Description} ({OS})'.format( - width=width, - q='"' if par['Name'] != '' else '', - **par)) - else: - print_error('\t\tPartition {Number:>{width}}:\t{Size} {q}{Name}{q} ({FileSystem})\t\t(Used space: {Used Space})'.format( - width=width, - q='"' if par['Name'] != '' else '', - **par)) - else: - print_warning('\t\tNo partitions found') - if (use_gpt): - print(' Using: \tGPT (UEFI) layout') - else: - print(' Using: \tMBR (legacy) layout') - print_info(' Installing:\t{winver}'.format(winver=selected_windows_version['Name'])) - if (not ask('\nIs this correct?')): - abort_to_main_menu('Aborting Windows setup') - - # Release currently used volume letters (ensures that the drives will get S, T, & W as needed below) - remove_volume_letters(keep=image['Source']) - - # Format and partition drive - if (use_gpt): - format_gpt(dest_drive, selected_windows_version['Family']) - else: - format_mbr(dest_drive) - - # Apply Windows image - errors = False - print(' Applying image...') - cmd = '{bin}\\wimlib\\wimlib-imagex apply "{File}.{Ext}" "{ImageName}" W:\\ {Glob}'.format(bin=bin, **image, **selected_windows_version) - try: - run_program(cmd) - except subprocess.CalledProcessError: - errors = True - print_error('Failed to apply Windows image.') - - # Create boot files - if not errors: - print(' Creating boot files...'.format(**selected_windows_version)) - try: - run_program('bcdboot W:\\Windows /s S: /f ALL') - except subprocess.CalledProcessError: - errors = True - print_error('Failed to create boot files.') - if re.search(r'^(8|10)', selected_windows_version['Family']): - try: - run_program('W:\\Windows\\System32\\reagentc /setreimage /path T:\\Recovery\\WindowsRE /target W:\\Windows') - except subprocess.CalledProcessError: - # errors = True # Changed to warning. - print_warning('Failed to setup WindowsRE files.') - - # Print summary - if errors: - print_warning('\nErrors were encountered during setup.') - time.sleep(300) - else: - print_success('\nNo errors were encountered during setup.') - time.sleep(10) - pause('\nPress Enter to return to main menu... ') - -def menu_tools(): - tools = [ - {'Name': 'Blue Screen View', 'Folder': 'BlueScreenView', 'File': 'BlueScreenView.exe'}, - {'Name': 'CPU-Z', 'Folder': 'CPU-Z', 'File': 'cpuz.exe'}, - {'Name': 'Explorer++', 'Folder': 'Explorer++', 'File': 'Explorer++.exe'}, - {'Name': 'Fast Copy', 'Folder': 'FastCopy', 'File': 'FastCopy.exe', 'Args': ['/log', '/logfile=X:\WK\Info\FastCopy.log', '/cmd=noexist_only', '/utf8', '/skip_empty_dir', '/linkdest', '/open_window', '/balloon=FALSE', r'/exclude=$RECYCLE.BIN;$Recycle.Bin;.AppleDB;.AppleDesktop;.AppleDouble;.com.apple.timemachine.supported;.dbfseventsd;.DocumentRevisions-V100*;.DS_Store;.fseventsd;.PKInstallSandboxManager;.Spotlight*;.SymAV*;.symSchedScanLockxz;.TemporaryItems;.Trash*;.vol;.VolumeIcon.icns;desktop.ini;Desktop?DB;Desktop?DF;hiberfil.sys;lost+found;Network?Trash?Folder;pagefile.sys;Recycled;RECYCLER;System?Volume?Information;Temporary?Items;Thumbs.db']}, - {'Name': 'HWiNFO', 'Folder': 'HWiNFO', 'File': 'HWiNFO.exe'}, - {'Name': 'HW Monitor', 'Folder': 'HWMonitor', 'File': 'HWMonitor.exe'}, - {'Name': 'NT Password Editor', 'Folder': 'NT Password Editor', 'File': 'ntpwedit.exe'}, - {'Name': 'Notepad2', 'Folder': 'Notepad2', 'File': 'Notepad2-Mod.exe'}, - {'Name': 'PhotoRec', 'Folder': 'TestDisk', 'File': 'photorec_win.exe', 'Args': ['-new_console:n']}, - {'Name': 'Prime95', 'Folder': 'Prime95', 'File': 'prime95.exe'}, - {'Name': 'ProduKey', 'Folder': 'ProduKey', 'File': 'ProduKey.exe', 'Args': ['/external', '/ExtractEdition:1']}, - {'Name': 'Q-Dir', 'Folder': 'Q-Dir', 'File': 'Q-Dir.exe'}, - {'Name': 'TestDisk', 'Folder': 'TestDisk', 'File': 'testdisk_win.exe', 'Args': ['-new_console:n']}, - ] - actions = [ - {'Name': 'Main Menu', 'Letter': 'M'}, - ] - - # Menu loop - while True: - selection = menu_select('Tools Menu', tools, actions) - - if (selection.isnumeric()): - tool = tools[int(selection)-1] - cmd = ['{bin}\\{folder}\\{file}'.format(bin=bin, folder=tool['Folder'], file=tool['File'])] - if tool['Name'] == 'Blue Screen View': - # Select path to scan - minidump_path = select_minidump_path() - if minidump_path is not None: - tool['Args'] = ['/MiniDumpFolder', minidump_path] - if 'Args' in tool: - cmd += tool['Args'] - try: - subprocess.Popen(cmd) - except: - print_error('Failed to run {prog}'.format(prog=tool['Name'])) - time.sleep(2) - elif (selection == 'M'): - break - -def menu_main(): - menus = [ - {'Name': 'Create Backups', 'Menu': menu_backup_imaging}, - {'Name': 'Install Windows', 'Menu': menu_windows_setup}, - {'Name': 'Misc Tools', 'Menu': menu_tools}, - ] - actions = [ - {'Name': 'Command Prompt', 'Letter': 'C'}, - {'Name': 'Reboot', 'Letter': 'R'}, - {'Name': 'Shutdown', 'Letter': 'S'}, - ] - - # Main loop - while True: - selection = menu_select('Main Menu', menus, actions, secret_exit=True) - - if (selection.isnumeric()): - try: - menus[int(selection)-1]['Menu']() - except AbortException: - pass - except: - print_error('Major exception in: {menu}'.format(menu=menus[int(selection)-1]['Name'])) - print_warning(' Please let The Wizard know and he\'ll look into it (Please include the details below).') - print(traceback.print_exc()) - print_info(' You can reboot and try again but if this crashes again an alternative approach is required.') - time.sleep(300) - pause('Press Enter to shutdown...') - run_program(['wpeutil', 'shutdown']) - elif (selection == 'C'): - run_program(['cmd', '-new_console:n'], check=False) - elif (selection == 'R'): - run_program(['wpeutil', 'reboot']) - elif (selection == 'S'): - run_program(['wpeutil', 'shutdown']) - else: - quit() - -if __name__ == '__main__': - menu_main() \ No newline at end of file diff --git a/.bin/Scripts/reset_browsers.ps1 b/.bin/Scripts/reset_browsers.ps1 deleted file mode 100644 index 9e6ccfca..00000000 --- a/.bin/Scripts/reset_browsers.ps1 +++ /dev/null @@ -1,388 +0,0 @@ -# Wizard Kit: Reset web browsers to safe default while saving user data - -## Init ## -$wd = $(Split-Path $MyInvocation.MyCommand.Path) -pushd "$wd" -. .\init.ps1 -clear -$host.UI.RawUI.WindowTitle = "Wizard Kit: Browser Reset Tool" -$backup_path = "$ClientPath\Backups\$username\$date" -$logpath = "$ClientPath\Info\$date" -md "$backup_path" 2>&1 | out-null -md "$logpath" 2>&1 | out-null -$log = "$logpath\Browsers.log" -$bin = (Get-Item $wd).Parent.FullName -$sz = "$bin\7-Zip\7za.exe" - -# Vars -$ff_appdata = "$appdata\Mozilla\Firefox" -$ff_clean = $false -$ff_exe = "$programfiles86\Mozilla Firefox\firefox.exe" -if (test-path "$programfiles\Mozilla Firefox\firefox.exe") { - $ff_exe = "$programfiles\Mozilla Firefox\firefox.exe" -} -$ff_profile_list = @(gci "$ff_appdata\Profiles" 2> $null | ?{ $_.PSIsContainer }) -$ff_profile_list = $ff_profile_list -inotmatch '\.WKBak' -$chrome_appdata = "$localappdata\Google\Chrome" -$chrome_clean = $false -$chrome_exe = "$programfiles86\Google\Chrome\Application\chrome.exe" -$chrome_profile_list = @(gci "$chrome_appdata\User Data" 2> $null | ?{ $_.PSIsContainer }) -$chrome_profile_list = $chrome_profile_list -inotmatch '\.WKBak' -imatch '^(Default|Profile)' - -# OS Check -. .\check_os.ps1 -if ($arch -eq 64) { - $sz = "$bin\7-Zip\7za64.exe" -} - -# Functions -function gen-backup-name { - param ([String]$name) - - # Add .WKBak to name - $newname = "$name.WKBak" - - # Check if the new name exists - if (test-path "$newname") { - # Change name to avoid overwriting any backups - $x = 2 - $newname = "$name.WKBak$x" - while (test-path "$newname") { - $x += 1 - $newname = "$name.WKBak$x" - } - } - - return $newname -} -function ff-create-default-profile { - WK-write " Creating new default profile" "$log" - # Check for existing profiles - if ($ff_profile_list.length -gt 0) { - WK-error " Firefox profile folders found. Possibly corrupt?" "$log" - return $false - } - - # Backup profiles.ini if necessary - ## NOTE: While you can use the profiles.ini to recreate the default profile, - ## it is better to create a new ini to better ensure the profile dir - ## will be in "$ff_appdata\Profiles\" - if (test-path "$ff_appdata\profiles.ini") { - mv "$ff_appdata\profiles.ini" (gen-backup-name "$ff_appdata\profiles.ini") - } - - # Create default profile - if (test-path "$ff_exe") { - $ff_args = @( - "-createprofile", - "default") - start -wait "$ff_exe" -argumentlist $ff_args -windowstyle minimized - } else { - WK-error " firefox.exe not found. Please verify installation." "$log" - return $false - } - return $true -} - - -## Internet Explorer ## -WK-write "==== Internet Explorer ====" "$log" - -# Cleanup -if (test-path ".bin\Bleachbit") { - WK-write " Removing temporary files" "$log" - pushd ".bin\Bleachbit" - start -wait "bleachbit_console.exe" -argumentlist @("-c", "internet_explorer.forms", "internet_explorer.temporary_files", "winapp2_internet.internet_explorer_10_11") -verb runas -windowstyle minimized - popd -} - -# Backup Favorites -if (test-path "$userprofile\Favorites") { - WK-write " Backing up Favorites" "$log" - pushd "$userprofile" - $sz_args = @( - "a", - "-t7z", - "-mx=1", - "$backup_path\IE Favorites.7z", - "Favorites") - start $sz -argumentlist $sz_args -wait -windowstyle minimized - popd -} - -# Get IE settings -$reset_homepage = $true -$ie_settings = gp -path hkcu:"Software\Microsoft\Internet Explorer\Main" - -# Reset IE settings (argmuentlist is case sensitive) -if (ask " Reset to default settings?" "$log") { - start -wait rundll32.exe -argumentlist 'inetcpl.cpl,ResetIEtoDefaults' -} - -# Get homepage(s) -$_current_homepage = $ie_settings."Start Page" -if ($_current_homepage -ne $null -and $_current_homepage.Length -ne 0) { - $_secondary_homepages = @($ie_settings."Secondary Start Pages") - WK-write " Current homepage: $_current_homepage" "$log" - foreach ($p in $_secondary_homepages) { - if ($p -ne $null -and $p.Length -ne 0) { - WK-write " $p" "$log" - } - } - if ($_current_homepage -inotmatch '^https://www\.google\.com/$' -or $_secondary_homepages -imatch '^.+') { - $reset_homepage = (ask " Replace current homepage with google.com?" "$log") - } -} - -# Set homepage(s) -WK-write " Setting homepage" "$log" -if ($reset_homepage) { - sp -path hkcu:"Software\Microsoft\Internet Explorer\Main" -name "Start Page" -Value "https://www.google.com/" 2>&1 | out-null - rp -path hkcu:"Software\Microsoft\Internet Explorer\Main" -name "Secondary Start Pages" 2>&1 | out-null -} else { - sp -path hkcu:"Software\Microsoft\Internet Explorer\Main" -name "Start Page" -Value $_current_homepage 2>&1 | out-null - new-itemproperty -path hkcu:"Software\Microsoft\Internet Explorer\Main" -name "Secondary Start Pages" -propertytype MultiString -value $_secondary_homepages 2>&1 | out-null -} - -# Additional settings -if (test-path "$programfiles86\Internet Explorer\iexplore.exe") { - if (ask " Install Google search add-on?" "$log") { - start -wait "$programfiles86\Internet Explorer\iexplore.exe" -argumentlist "http://www.iegallery.com/en-us/Addons/Details/813" - } - #if (ask " Install AdBlock Plus?" "$log") { - # start -wait "$programfiles86\Internet Explorer\iexplore.exe" -argumentlist "https://adblockplus.org" - #} -} else { - WK-error " $programfiles86\Internet Explorer\iexplore.exe not found" "$log" -} -WK-write "" "$log" - - -## Mozilla Firefox ## -WK-write "==== Mozilla Firefox ====" "$log" -$ff_errors = 0 - -# Reduce size of AppData folder -if (test-path ".bin\Bleachbit") { - WK-write " Removing temporary files" "$log" - pushd ".bin\Bleachbit" - start -wait "bleachbit_console.exe" -argumentlist @("-c", "firefox.cache", "firefox.forms", "firefox.session_restore", "firefox.vacuum", "winapp2_mozilla.corrupt_sqlites") -verb runas -nonewwindow - popd -} - -# Backup AppData -if (test-path "$ff_appdata") { - WK-write " Backing up AppData" "$log" - pushd "$ff_appdata" - $sz_args = @( - "a", - "-t7z", - "-mx=1", - "$backup_path\Firefox.7z", - "Profiles", - "profiles.ini") - start $sz -argumentlist $sz_args -wait -windowstyle minimized - popd -} - -# Create default profile if necessary -if ($ff_profile_list.length -eq 0) { - if (ff-create-default-profile) { - # Update profile list to catch newly created profiles - sleep -s 1 - $ff_profile_list = @(gci "$ff_appdata\Profiles" 2> $null | ?{ $_.PSIsContainer }) - $ff_profile_list = $ff_profile_list -inotmatch '\.WKBak\d*$' - if ($ff_profile_list.length -eq 0) { - WK-warn " Failed to create default profile." "$log" - $ff_errors += 1 - } else { - # Configure new profile - $ff_clean = $true - } - } else { - WK-error " Failed to create default profile." "$log" - $ff_errors += 1 - } -} else { - WK-write " Profiles found: $($ff_profile_list.length)" "$log" - $ff_clean = (ask " Reset profile(s) to safe settings?" "$log") -} - -# Reset profile(s) to safe defaults -if ($ff_clean -and $ff_errors -eq 0) { - pushd "$ff_appdata\Profiles" - foreach ($ff_profile in $ff_profile_list) { - WK-write " Resetting profile: $ff_profile" "$log" - - # Backup old settings and only preserve essential settings - $ff_profile_bak = (gen-backup-name "$ff_profile") - mv "$ff_profile" "$ff_profile_bak" - md "$ff_profile" 2>&1 | out-null - - # Add "search.json" to $robocopy_args preserve added search engines - $robocopy_args = @( - "/r:3", - "/w:1", - "$ff_profile_bak", - "$ff_profile", - "cookies.sqlite", - "formhistory.sqlite", - "key3.db", - "logins.json", - "persdict.dat", - "places.sqlite") - start "robocopy" -argumentlist $robocopy_args -wait -windowstyle minimized - - # Add "searchplugins" below to preserve added search engines - foreach ($subdir in @("bookmarkbackups")) { - if (test-path "$ff_profile_bak\$subdir") { - md "$ff_profile\$subdir" 2>&1 | out-null - $robocopy_args = @( - "/e", - "/r:3", - "/w:1", - "$ff_profile_bak\$subdir", - "$ff_profile\$subdir") - start "robocopy" -argumentlist $robocopy_args -wait -windowstyle minimized - } - } - - # Set homepage and search settings - WK-write " Setting homepage and default search" "$log" - out-file -encoding 'ascii' -filepath "$ff_profile\prefs.js" -inputobject 'user_pref("browser.search.geoSpecificDefaults", false);' - out-file -encoding 'ascii' -filepath "$ff_profile\prefs.js" -inputobject 'user_pref("browser.search.defaultenginename", "Google");' -append - out-file -encoding 'ascii' -filepath "$ff_profile\prefs.js" -inputobject 'user_pref("browser.search.defaultenginename.US", "Google");' -append - $homepage = "https://www.google.com/" - if (test-path "$ff_profile_bak\prefs.js") { - $_prefs = gc "$ff_profile_bak\prefs.js" - if ($_prefs -imatch '"browser.startup.homepage"') { - $_current_homepage = $_prefs -imatch '"browser.startup.homepage"' - $_current_homepage = $_current_homepage -ireplace 'user_pref\("browser.startup.homepage", "(.*)"\);', '$1' - $_header = " Current homepage:" - foreach ($url in @("$_current_homepage".split("|"))) { - WK-write "$_header $_current_homepage" "$log" - $_header = " " - } - if ($_current_homepage -inotmatch '^https://www\.google\.com/$') { - if (!(ask " Replace current homepage with google.com?" "$log")) { - $homepage = $_cur_home - } - } - } - } - $homepage = 'user_pref("browser.startup.homepage", "' + $homepage + '");' - out-file -encoding 'ascii' -filepath "$ff_profile\prefs.js" -inputobject $homepage -append - WK-write "" "$log" - } - popd -} - -# Install uBlock Origin -if (test-path "$ff_exe") { - if ($ff_errors -eq 0 -and (ask " Install uBlock Origin?" "$log")) { - start -wait "$ff_exe" -argumentlist "https://addons.mozilla.org/en-us/firefox/addon/ublock-origin/" - } -} else { - WK-error " firefox.exe not found. Please verify installation." "$log" -} - -WK-write "" "$log" - - -## Google Chrome ## -WK-write "==== Google Chrome ====" "$log" -$chrome_errors = 0 - -# Reduce size of AppData folder -if (test-path ".bin\Bleachbit") { - WK-write " Removing temporary files" "$log" - pushd ".bin\Bleachbit" - start -wait "bleachbit_console.exe" -argumentlist @("-c", "google_chrome.cache", "google_chrome.form_history", "google_chrome.search_engines", "google_chrome.session", "google_chrome.vacuum") -verb runas -nonewwindow - popd -} - -# Backup AppData -if (test-path "$chrome_appdata") { - WK-write " Backing up AppData" "$log" - pushd "$chrome_appdata" - $sz_args = @( - "a", - "-t7z", - "-mx=1", - "$backup_path\Chrome.7z", - '"User Data"') - start $sz -argumentlist $sz_args -wait -windowstyle minimized - popd -} - -# Check for profiles -if ($chrome_profile_list.length -gt 0) { - WK-write " Profiles found: $($chrome_profile_list.length)" "$log" - $chrome_clean = (ask " Reset profile(s) to safe settings?" "$log") -} else { - WK-warn " No profiles found" "$log" -} - -# Reset profile(s) to safe defaults -if ($chrome_clean -and $chrome_errors -eq 0) { - pushd "$chrome_appdata\User Data" - foreach ($chrome_profile in $chrome_profile_list) { - WK-write " Cleaning profile: $chrome_profile" "$log" - $chrome_profile_bak = (gen-backup-name "$chrome_profile") - mv "$chrome_profile" "$chrome_profile_bak" - md "$chrome_profile" 2>&1 | out-null - $robocopy_args = @( - "/r:3", - "/w:1", - "$chrome_profile_bak", - "$chrome_profile", - "Bookmarks", - "Cookies", - "Favicons", - '"Google Profile*"', - "History", - '"Login Data"', - '"Top Sites"', - "TransportSecurity", - '"Visited Links"', - '"Web Data"') - start "robocopy" -argumentlist $robocopy_args -wait -windowstyle minimized - WK-write "" "$log" - } - popd -} - -# Test for single-user installation -if (test-path "$chrome_appdata\Application\chrome.exe") { - if (test-path "$chrome_exe") { - WK-warn " Single-user and multi-user installations present. Please reinstall Chrome." "$log" - } else { - $chrome_exe = "$chrome_appdata\Application\chrome.exe" - } -} - -if (test-path "$chrome_exe") { - # Set Chrome as default browser - start -wait "$chrome_exe" -argumentlist "--make-default-browser" - - # Install uBlock Origin - if ($chrome_errors -eq 0 -and (ask " Install uBlock Origin?" "$log")) { - start -wait "$chrome_exe" -argumentlist "https://chrome.google.com/webstore/detail/ublock-origin/cjpalhdlnbpafiamejdnhcphjbkeiagm?hl=en" - } -} else { - WK-error " chrome.exe not found. Please verify installation." "$log" -} -WK-write "" "$log" - - -## Done ## -popd -pause "Press Enter to exit..." - -# Open log -$notepad2 = "$bin\Notepad2\Notepad2-Mod.exe" -if (test-path $notepad2) { - start "$notepad2" -argumentlist $log -} else { - start "notepad" -argumentlist $log -} diff --git a/.bin/Scripts/reset_browsers.py b/.bin/Scripts/reset_browsers.py new file mode 100644 index 00000000..5381af7a --- /dev/null +++ b/.bin/Scripts/reset_browsers.py @@ -0,0 +1,588 @@ +# Wizard Kit: Browser Reset Tool + +import os +import re +import shutil +import subprocess +import winreg + +# Init +os.chdir(os.path.dirname(os.path.realpath(__file__))) +os.system('title Wizard Kit: Browser Reset Tool') +from functions import * +vars_wk = init_vars_wk() +vars_wk.update(init_vars_os()) +vars_wk['BackupDir'] = '{ClientDir}\\Backups\\{Date}\\{USERNAME}'.format(**vars_wk, **vars_wk['Env']) +vars_wk['LogFile'] = '{LogDir}\\Reset Browsers.log'.format(**vars_wk) +vars_wk['BleachBit'] = '{BinDir}\\BleachBit\\bleachbit_console.exe'.format(**vars_wk) +vars_wk['Notepad2'] = '{BinDir}\\Notepad2\\Notepad2-Mod.exe'.format(**vars_wk) +vars_wk['SevenZip'] = '{BinDir}\\7-Zip\\7za.exe'.format(**vars_wk) +if vars_wk['Arch'] == 64: + vars_wk['Notepad2'] = vars_wk['Notepad2'].replace('.exe', '64.exe') + vars_wk['SevenZip'] = vars_wk['SevenZip'].replace('.exe', '64.exe') +os.makedirs('{BackupDir}'.format(**vars_wk), exist_ok=True) +os.makedirs('{LogDir}'.format(**vars_wk), exist_ok=True) +os.makedirs('{TmpDir}'.format(**vars_wk), exist_ok=True) + +# VARIABLES +DEFAULT_HOMEPAGE = 'https://www.google.com/' +REGEX_CHROMIUM_ITEMS = re.compile(r'^(Bookmarks|Cookies|Favicons|Google Profile|History|Login Data|Top Sites|TransportSecurity|Visited Links|Web Data).*', re.IGNORECASE) +REGEX_FIREFOX = re.compile(r'^(bookmarkbackups|(cookies|formhistory|places).sqlite|key3.db|logins.json|persdict.dat)$', re.IGNORECASE) + +def abort(): + print_warning('Aborted.', vars_wk['LogFile']) + exit_script() + +def backup_browsers(): + """Create backups of all supported browsers in the BackupDir.""" + print_info('* Backing up browser data', vars_wk['LogFile']) + # Chromium + if os.path.exists('{LOCALAPPDATA}\\Chromium\\User Data'.format(**vars_wk['Env'])): + print_standard(' Chromium', vars_wk['LogFile']) + _cmd = '{SevenZip} a -aoa -bso0 -bse0 -mx=1 "{BackupDir}\\Chromium.7z" "{LOCALAPPDATA}\\Chromium\\User Data"'.format(**vars_wk, **vars_wk['Env']) + run_program(_cmd, check=False, pipe=False) + + # Google Chrome + if os.path.exists('{LOCALAPPDATA}\\Google\\Chrome\\User Data'.format(**vars_wk['Env'])): + print_standard(' Google Chrome', vars_wk['LogFile']) + _cmd = '{SevenZip} a -aoa -bso0 -bse0 -mx=1 "{BackupDir}\\Google Chrome.7z" "{LOCALAPPDATA}\\Google\\Chrome\\User Data"'.format(**vars_wk, **vars_wk['Env']) + run_program(_cmd, check=False, pipe=False) + + # Google Chrome Canary + if os.path.exists('{LOCALAPPDATA}\\Google\\Chrome SxS\\User Data'.format(**vars_wk['Env'])): + print_standard(' Google Chrome Canary', vars_wk['LogFile']) + _cmd = '{SevenZip} a -aoa -bso0 -bse0 -mx=1 "{BackupDir}\\Google Chrome Canary.7z" "{LOCALAPPDATA}\\Google\\Chrome SxS\\User Data"'.format(**vars_wk, **vars_wk['Env']) + run_program(_cmd, check=False, pipe=False) + + # Internet Explorer + if os.path.exists('{USERPROFILE}\\Favorites'.format(**vars_wk['Env'])): + print_standard(' Internet Explorer', vars_wk['LogFile']) + _cmd = [ + vars_wk['SevenZip'], + 'a', + '-aoa', + '-bso0', + '-bse0', + '-mx=1', + '{BackupDir}\\Internet Explorer.7z'.format(**vars_wk), + '{USERPROFILE}\\Favorites'.format(**vars_wk['Env'])] + run_program(_cmd, check=False, pipe=False) + run_program('reg export "hkcu\\Software\\Microsoft\\Internet Explorer" "{TmpDir}\\Internet Explorer (HKCU).reg" /y'.format(**vars_wk), check=False, shell=True) + run_program('reg export "hklm\\Software\\Microsoft\\Internet Explorer" "{TmpDir}\\Internet Explorer (HKLM).reg" /y'.format(**vars_wk), check=False, shell=True) + _cmd = [ + vars_wk['SevenZip'], + 'a', + '-aoa', + '-bso0', + '-bse0', + '-mx=1', + '{BackupDir}\\Internet Explorer.7z'.format(**vars_wk), + '{TmpDir}\\Internet*.reg'.format(**vars_wk)] + run_program(_cmd, check=False, pipe=False) + + # Mozilla Firefox + if os.path.exists('{APPDATA}\\Mozilla\\Firefox'.format(**vars_wk['Env'])): + print_standard(' Mozilla Firefox', vars_wk['LogFile']) + _cmd = '{SevenZip} a -aoa -bso0 -bse0 -mx=1 "{BackupDir}\\Mozilla Firefox.7z" "{APPDATA}\\Mozilla\\Firefox\\Profile*"'.format(**vars_wk, **vars_wk['Env']) + run_program(_cmd, check=False, pipe=False) + + # Opera + if os.path.exists('{APPDATA}\\Opera Software\\Opera Stable'.format(**vars_wk['Env'])): + print_standard(' Opera', vars_wk['LogFile']) + _cmd = '{SevenZip} a -aoa -bso0 -bse0 -mx=1 "{BackupDir}\\Opera.7z" "{APPDATA}\\Opera Software\\Opera Stable"'.format(**vars_wk, **vars_wk['Env']) + run_program(_cmd, check=False, pipe=False) + + # Opera Beta + if os.path.exists('{APPDATA}\\Opera Software\\Opera Next'.format(**vars_wk['Env'])): + print_standard(' Opera Beta', vars_wk['LogFile']) + _cmd = '{SevenZip} a -aoa -bso0 -bse0 -mx=1 "{BackupDir}\\Opera Beta.7z" "{APPDATA}\\Opera Software\\Opera Next"'.format(**vars_wk, **vars_wk['Env']) + run_program(_cmd, check=False, pipe=False) + + # Opera Dev + if os.path.exists('{APPDATA}\\Opera Software\\Opera Developer'.format(**vars_wk['Env'])): + print_standard(' Opera Dev', vars_wk['LogFile']) + _cmd = '{SevenZip} a -aoa -bso0 -bse0 -mx=1 "{BackupDir}\\Opera Dev.7z" "{APPDATA}\\Opera Software\\Opera Developer"'.format(**vars_wk, **vars_wk['Env']) + run_program(_cmd, check=False, pipe=False) + +def clean_chromium_profile(profile): + """Renames profile folder as backup and then recreates the folder with only the essential files.""" + print_info(' Resetting profile: {name}'.format(name=profile.name), vars_wk['LogFile']) + backup_path = rename_as_backup(profile.path) + os.makedirs(profile.path, exist_ok=True) + + # Restore essential files from backup_path + for entry in os.scandir(backup_path): + if REGEX_CHROMIUM_ITEMS.search(entry.name): + shutil.copy(entry.path, '{path}\\{name}'.format(path=profile.path, name=entry.name)) + +def clean_firefox_profile(profile): + """Renames profile folder as backup and then recreates the folder with only the essential files.""" + print_info(' Resetting profile: {name}'.format(name=profile.name), vars_wk['LogFile']) + backup_path = rename_as_backup(profile.path) + homepages = [] + os.makedirs(profile.path, exist_ok=True) + + # Restore essential files from backup_path + for entry in os.scandir(backup_path): + if REGEX_FIREFOX.search(entry.name): + if entry.is_dir(): + shutil.copytree(entry.path, '{path}\\{name}'.format(path=profile.path, name=entry.name)) + else: + shutil.copy(entry.path, '{path}\\{name}'.format(path=profile.path, name=entry.name)) + + # Check current Homepage + try: + with open('{path}\\prefs.js'.format(path=backup_path), 'r') as f: + _search = re.search(r'browser\.startup\.homepage", "([^"]*)"', f.read(), re.IGNORECASE) + if _search: + homepages = _search.group(1).split('|') + except FileNotFoundError: + pass + + # Set profile defaults + with open('{path}\\prefs.js'.format(path=profile.path), 'a', encoding='ascii') as f: + f.write('user_pref("browser.search.geoSpecificDefaults", false);\n') + + # Set search to Google + f.write('user_pref("browser.search.defaultenginename", "Google");\n') + f.write('user_pref("browser.search.defaultenginename.US", "Google");\n') + + # Set homepage + if len(homepages) == 0: + homepages = [DEFAULT_HOMEPAGE] + elif len(homepages) > 1 or DEFAULT_HOMEPAGE not in homepages: + # Not set to [DEFAULT_HOMEPAGE], ask if switching + print_warning(' Current homepage: {url}'.format(url=homepages[0]), vars_wk['LogFile']) + for url in homepages[1:]: + print_warning(' : {url}'.format(url=url), vars_wk['LogFile']) + if ask(' Replace with {url}?'.format(url=DEFAULT_HOMEPAGE), vars_wk['LogFile']): + homepages = [DEFAULT_HOMEPAGE] + f.write('user_pref("browser.startup.homepage", "{urls}");\n'.format(urls='|'.join(homepages))) + +def clean_internet_explorer(): + """Uses the built-in function to reset IE and sets the homepage.""" + print_info(' Closing any open windows', vars_wk['LogFile']) + kill_process('iexplore.exe') + print_info(' Resetting internet options', vars_wk['LogFile']) + run_program('rundll32.exe', ['inetcpl.cpl,ResetIEtoDefaults'], check=False) + + # Set homepage + key = r'Software\Microsoft\Internet Explorer\Main' + with winreg.OpenKey(winreg.HKEY_CURRENT_USER, key) as _key: + homepage = winreg.QueryValueEx(_key, 'Start Page')[0] + try: + secondary_homepages = winreg.QueryValueEx(_key, 'Secondary Start Pages')[0] + except FileNotFoundError: + secondary_homepages = [] + print_standard(' Current homepage: ' + homepage, vars_wk['LogFile']) + for page in secondary_homepages: + print_standard(' : ' + page, vars_wk['LogFile']) + if homepage != DEFAULT_HOMEPAGE or len(secondary_homepages) > 0: + if ask(' Replace current homepage with google.com?', vars_wk['LogFile']): + with winreg.OpenKey(winreg.HKEY_CURRENT_USER, key, access=winreg.KEY_WRITE) as _key: + winreg.SetValueEx(_key, 'Start Page', 0, winreg.REG_SZ, DEFAULT_HOMEPAGE) + try: + winreg.DeleteValue(_key, 'Secondary Start Pages') + except FileNotFoundError: + pass + +def exit_script(): + # pause("Press Enter to exit...") + quit() + +def get_chrome_exe(): + """Check for conflicting Chrome installations and return chrome.exe path as str.""" + install_multi = '{PROGRAMFILES}\\Google\\Chrome\\Application\\chrome.exe'.format(**vars_wk['Env']) + if 'PROGRAMFILES(X86)' in vars_wk['Env']: + install_multi = '{PROGRAMFILES(X86)}\\Google\\Chrome\\Application\\chrome.exe'.format(**vars_wk['Env']) + install_single = '{LOCALAPPDATA}\\Google\\Chrome\\Application\\chrome.exe'.format(**vars_wk['Env']) + if os.path.exists(install_multi): + if os.path.exists(install_single): + print_warning(' WARNING: Single-user and multi-user installations present.', vars_wk['LogFile']) + print_warning(' It is recommended to move to only having the multi-user installation.', vars_wk['LogFile']) + return install_multi + elif os.path.exists(install_single): + return install_single + else: + print_error(' ERROR: chrome.exe not found. Please verify installation.', vars_wk['LogFile']) + return None + +def get_chrome_profiles(): + """Find any existing Chrome profiles and return as a list of os.DirEntry objects.""" + profiles = [] + for entry in os.scandir('{LOCALAPPDATA}\\Google\\Chrome\\User Data'.format(**vars_wk['Env'])): + if entry.is_dir() and re.search(r'^(Default|Profile)', entry.name, re.IGNORECASE): + profiles.append(entry) + profiles = [p for p in profiles if not re.search(r'\.(wk|)bak.*', p.name, re.IGNORECASE)] + + return profiles + +def get_chrome_canary_exe(): + """Check for Google Chrome Canary installation and return chrome.exe path as str.""" + prog_exe = '{LOCALAPPDATA}\\Google\\Chrome SxS\\Application\\chrome.exe'.format(**vars_wk['Env']) + if os.path.exists(prog_exe): + return prog_exe + else: + print_error(' ERROR: chrome.exe not found. Please verify installation.', vars_wk['LogFile']) + return None + +def get_chrome_canary_profiles(): + """Find any existing Chrome profiles and return as a list of os.DirEntry objects.""" + profiles = [] + for entry in os.scandir('{LOCALAPPDATA}\\Google\\Chrome SxS\\User Data'.format(**vars_wk['Env'])): + if entry.is_dir() and re.search(r'^(Default|Profile)', entry.name, re.IGNORECASE): + profiles.append(entry) + profiles = [p for p in profiles if not re.search(r'\.(wk|)bak.*', p.name, re.IGNORECASE)] + + return profiles + +def get_iexplorer_exe(): + """Find and return iexplorer.exe path as str.""" + ie_exe = '{PROGRAMFILES}\\Internet Explorer\\iexplore.exe'.format(**vars_wk['Env']) + if 'PROGRAMFILES(X86)' in vars_wk['Env']: + ie_exe = '{PROGRAMFILES(X86)}\\Internet Explorer\\iexplore.exe'.format(**vars_wk['Env']) + return ie_exe + +def get_firefox_exe(): + """Check for Mozilla Firefox installation and return firefox.exe path as str.""" + prog_exe = '{PROGRAMFILES}\\Mozilla Firefox\\firefox.exe'.format(**vars_wk['Env']) + if 'PROGRAMFILES(X86)' in vars_wk['Env']: + prog_exe = '{PROGRAMFILES(X86)}\\Mozilla Firefox\\firefox.exe'.format(**vars_wk['Env']) + if os.path.exists(prog_exe): + return prog_exe + else: + return None + +def get_firefox_dev_exe(): + """Check for Mozilla Firefox Developer Edition installation and return firefox.exe path as str.""" + prog_exe = '{PROGRAMFILES}\\Firefox Developer Edition\\firefox.exe'.format(**vars_wk['Env']) + if 'PROGRAMFILES(X86)' in vars_wk['Env']: + prog_exe = '{PROGRAMFILES(X86)}\\Firefox Developer Edition\\firefox.exe'.format(**vars_wk['Env']) + if os.path.exists(prog_exe): + return prog_exe + else: + return None + +def get_opera_exe(): + """Check for Opera installation and return launcher.exe path as str.""" + prog_exe = '{PROGRAMFILES}\\Opera\\launcher.exe'.format(**vars_wk['Env']) + if 'PROGRAMFILES(X86)' in vars_wk['Env']: + prog_exe = '{PROGRAMFILES(X86)}\\Opera\\launcher.exe'.format(**vars_wk['Env']) + if os.path.exists(prog_exe): + return prog_exe + else: + return None + +def get_firefox_profiles(): + """Find any existing Chrome profiles and return as a list of os.DirEntry objects.""" + profiles = [] + for entry in os.scandir('{APPDATA}\\Mozilla\\Firefox\\Profiles'.format(**vars_wk['Env'])): + if entry.is_dir(): + profiles.append(entry) + profiles = [p for p in profiles if not re.search(r'\.(wk|)bak.*', p.name, re.IGNORECASE)] + + return profiles + +def create_firefox_default_profiles(): + """Create new default profile for Mozilla Firefox for both stable and dev releases.""" + print_warning(' WARNING: Creating new default profile.', vars_wk['LogFile']) + firefox_exe = get_firefox_exe() + firefox_dev_exe = get_firefox_dev_exe() + profiles_ini_path = '{APPDATA}\\Mozilla\\Firefox\\profiles.ini'.format(**vars_wk['Env']) + + # Rename profiles.ini + if os.path.exists(profiles_ini_path): + rename_as_backup(profiles_ini_path) + + # Create profile(s) + if firefox_exe is not None: + run_program(firefox_exe, ['-createprofile', 'default'], check=False) + if firefox_dev_exe is not None: + run_program(firefox_dev_exe, ['-createprofile'], check=False) + +def get_opera_beta_exe(): + """Check for Opera Beta installation and return launcher.exe path as str.""" + prog_exe = '{PROGRAMFILES}\\Opera beta\\launcher.exe'.format(**vars_wk['Env']) + # Installs as 64-bit on a 64-bit OS so PROGRAMFILES should always be correct + + if os.path.exists(prog_exe): + return prog_exe + else: + return None + +def get_opera_dev_exe(): + """Check for Opera Beta installation and return launcher.exe path as str.""" + prog_exe = '{PROGRAMFILES}\\Opera developer\\launcher.exe'.format(**vars_wk['Env']) + # Installs as 64-bit on a 64-bit OS so PROGRAMFILES should always be correct + + if os.path.exists(prog_exe): + return prog_exe + else: + return None + +def get_opera_profile(): + """Find an existing Opera profile and return as a length-1 list of os.DirEntry objects.""" + profiles = [] + for entry in os.scandir('{APPDATA}\\Opera Software'.format(**vars_wk['Env'])): + if entry.is_dir() and entry.name == 'Opera Stable': + return [entry] + + return profiles + +def get_opera_beta_profile(): + """Find an existing Opera Beta profile and return as a length-1 list of os.DirEntry objects.""" + profiles = [] + for entry in os.scandir('{APPDATA}\\Opera Software'.format(**vars_wk['Env'])): + if entry.is_dir() and entry.name == 'Opera Next': + return [entry] + + return profiles + +def get_opera_dev_profile(): + """Find an existing Opera Dev profile and return as a length-1 list of os.DirEntry objects.""" + profiles = [] + for entry in os.scandir('{APPDATA}\\Opera Software'.format(**vars_wk['Env'])): + if entry.is_dir() and entry.name == 'Opera Developer': + return [entry] + + return profiles + +def remove_temp_files(): + """Run BleachBit to delete cache, temp, and corrupt data from browsers.""" + print_info('* Deleting browser temp data', vars_wk['LogFile']) + if not ask(' Proceed?', vars_wk['LogFile']): + # Bail early + return + # Extract and delete + extract_item('BleachBit', vars_wk, silent=True) + _args = [ + '-c', + # Chromium + 'chromium.cache', + 'chromium.search_engines', + 'chromium.current_session', + 'chromium.vacuum', + # Google Chrome + 'google_chrome.cache', + 'google_chrome.search_engines', + 'google_chrome.session', + 'google_chrome.vacuum', + # Internet Explorer + 'internet_explorer.temporary_files', + # Mozilla Firefox + 'firefox.cache', + 'firefox.session_restore', + 'firefox.vacuum', + 'winapp2_mozilla.corrupt_sqlites', + # Opera + 'opera.cache', + 'opera.current_session'] + try: + _out = run_program(vars_wk['BleachBit'], _args, check=False) + except subprocess.CalledProcessError: + print_error(' ERROR: Failed to run BleachBit.', vars_wk['LogFile']) + if not ask(' Continue script?', vars_wk['LogFile']): + abort() + else: + # Save BleachBit log + with open('{LogDir}\\BleachBit.log'.format(**vars_wk), 'a') as f: + f.write(_out.stdout.decode()) + # Save BleachBit (error) log + with open('{LogDir}\\BleachBit.err.log'.format(**vars_wk), 'a') as f: + f.write(_out.stderr.decode()) + +def rename_as_backup(profile_path): + backup_path = '{path}.bak'.format(path=profile_path) + _i = 1; + while os.path.exists(backup_path): + backup_path = '{path}.bak{i}'.format(i=_i, path=profile_path) + _i += 1 + + # print_info(' Renaming "{path}" to "{backup}"'.format(path=profile_path, backup=backup_path), vars_wk['LogFile']) + shutil.move(profile_path, backup_path) + + return backup_path + +def reset_internet_explorer(): + print_standard(' Internet Explorer', vars_wk['LogFile']) + ie_exe = get_iexplorer_exe() + + if ask(' Reset to safe settings?', vars_wk['LogFile']): + clean_internet_explorer() + + if os.path.exists(ie_exe): + if ask(' Install Google Search and EasyLists?', vars_wk['LogFile']): + run_program(ie_exe, ['http://www.iegallery.com/en-us/Addons/Details/813'], check=False) + else: + print_error(' ERROR: iexplore.exe not found. Please verify OS health.', vars_wk['LogFile']) + +def reset_google_chrome(): + print_standard(' Google Chrome', vars_wk['LogFile']) + chrome_exe = get_chrome_exe() + profiles = get_chrome_profiles() + + if len(profiles) == 0: + print_warning(' WARNING: No profiles found.', vars_wk['LogFile']) + elif ask(' Reset profile(s) to safe settings?', vars_wk['LogFile']): + print_info(' Closing any open windows', vars_wk['LogFile']) + kill_process('chrome.exe') + for profile in profiles: + clean_chromium_profile(profile) + + if chrome_exe is not None: + # Set Chrome as default browser + run_program(chrome_exe, ['--make-default-browser'], check=False) + + # Install uBlock Origin? + if ask(' Install uBlock Origin?', vars_wk['LogFile']): + run_program(chrome_exe, ['https://chrome.google.com/webstore/detail/ublock-origin/cjpalhdlnbpafiamejdnhcphjbkeiagm?hl=en'], check=False) + + # Google Chrome Canary + chrome_canary_exe = get_chrome_canary_exe() + profiles = get_chrome_canary_profiles() + + if len(profiles) > 0: + print_standard(' Google Chrome Canary', vars_wk['LogFile']) + if ask(' Reset profile(s) to safe settings?', vars_wk['LogFile']): + print_info(' Closing any open windows', vars_wk['LogFile']) + kill_process('chrome.exe') + for profile in profiles: + clean_chromium_profile(profile) + + if chrome_canary_exe is not None: + # Install uBlock Origin? + if ask(' Install uBlock Origin?', vars_wk['LogFile']): + run_program(chrome_canary_exe, ['https://chrome.google.com/webstore/detail/ublock-origin/cjpalhdlnbpafiamejdnhcphjbkeiagm?hl=en'], check=False) + +def reset_mozilla_firefox(): + print_standard(' Mozilla Firefox', vars_wk['LogFile']) + firefox_exe = get_firefox_exe() + firefox_dev_exe = get_firefox_dev_exe() + profiles = get_firefox_profiles() + + if firefox_exe is None and firefox_dev_exe is None: + print_error(' ERROR: firefox.exe not found. Please verify installation.', vars_wk['LogFile']) + + if len(profiles) == 0: + print_warning(' WARNING: No profiles found.', vars_wk['LogFile']) + create_firefox_default_profiles() + elif ask(' Reset profile(s) to safe settings?', vars_wk['LogFile']): + print_info(' Closing any open windows', vars_wk['LogFile']) + kill_process('firefox.exe') + for profile in profiles: + clean_firefox_profile(profile) + + if ask(' Install uBlock Origin?', vars_wk['LogFile']): + # Install uBlock Origin + if firefox_exe is not None: + run_program(firefox_exe, ['https://addons.mozilla.org/en-us/firefox/addon/ublock-origin/'], check=False) + if firefox_dev_exe is not None: + run_program(firefox_dev_exe, ['https://addons.mozilla.org/en-us/firefox/addon/ublock-origin/'], check=False) + +def reset_opera(): + print_standard(' Opera', vars_wk['LogFile']) + opera_exe = get_opera_exe() + profiles = get_opera_profile() + + # Bail early + if opera_exe is None and len(profiles) == 0: + print_warning(' Opera not installed and no profiles found.') + return + + if opera_exe is None: + print_error(' ERROR: Opera not installed.', vars_wk['LogFile']) + + if len(profiles) == 0: + print_warning(' WARNING: No profiles found.', vars_wk['LogFile']) + else: + # Reset browser + if ask(' Reset profile to safe settings?', vars_wk['LogFile']): + print_info(' Closing any open windows', vars_wk['LogFile']) + kill_process('opera.exe') + clean_chromium_profile(profiles[0]) + + if opera_exe is not None: + # Install uBlock Origin? + if ask(' Install uBlock Origin?', vars_wk['LogFile']): + run_program(opera_exe, ['https://addons.opera.com/en/extensions/details/ublock/?display=en'], check=False) + +def reset_opera_beta(): + opera_beta_exe = get_opera_beta_exe() + profiles = get_opera_beta_profile() + + # Bail early + if opera_beta_exe is None and len(profiles) == 0: + print_error(' Opera Beta not installed and no profiles found.') + return + else: + print_standard(' Opera Beta', vars_wk['LogFile']) + + if opera_beta_exe is None: + print_error(' ERROR: Opera Beta not installed.', vars_wk['LogFile']) + + if len(profiles) == 0: + print_warning(' WARNING: No profiles found.', vars_wk['LogFile']) + else: + # Reset browser + if ask(' Reset profile to safe settings?', vars_wk['LogFile']): + print_info(' Closing any open windows', vars_wk['LogFile']) + kill_process('opera.exe') + clean_chromium_profile(profiles[0]) + + if opera_beta_exe is not None: + # Install uBlock Origin? + if ask(' Install uBlock Origin?', vars_wk['LogFile']): + run_program(opera_beta_exe, ['https://addons.opera.com/en/extensions/details/ublock/?display=en'], check=False) + +def reset_opera_dev(): + opera_dev_exe = get_opera_dev_exe() + profiles = get_opera_dev_profile() + + # Bail early + if opera_dev_exe is None and len(profiles) == 0: + print_error(' Opera Dev not installed and no profiles found.') + return + else: + print_standard(' Opera Dev', vars_wk['LogFile']) + + if opera_dev_exe is None: + print_error(' ERROR: Opera Dev not installed.', vars_wk['LogFile']) + + if len(profiles) == 0: + print_warning(' WARNING: No profiles found.', vars_wk['LogFile']) + else: + # Reset browser + if ask(' Reset profile to safe settings?', vars_wk['LogFile']): + print_info(' Closing any open windows', vars_wk['LogFile']) + kill_process('opera.exe') + clean_chromium_profile(profiles[0]) + + if opera_dev_exe is not None: + # Install uBlock Origin? + if ask(' Install uBlock Origin?', vars_wk['LogFile']): + run_program(opera_dev_exe, ['https://addons.opera.com/en/extensions/details/ublock/?display=en'], check=False) + +if __name__ == '__main__': + stay_awake(vars_wk) + + # Reset prep + backup_browsers() + remove_temp_files() + + # Reset Browsers + print_info('* Resetting browsers', vars_wk['LogFile']) + reset_internet_explorer() + reset_google_chrome() + reset_mozilla_firefox() + reset_opera() + reset_opera_beta() + reset_opera_dev() + + # Done + print_standard('Done.', vars_wk['LogFile']) + extract_item('Notepad2', vars_wk, silent=True) + subprocess.Popen([vars_wk['Notepad2'], vars_wk['LogFile']]) + + # Quit + kill_process('caffeine.exe') + exit_script() \ No newline at end of file diff --git a/.bin/Scripts/safemode_enter.py b/.bin/Scripts/safemode_enter.py new file mode 100644 index 00000000..f47be6a4 --- /dev/null +++ b/.bin/Scripts/safemode_enter.py @@ -0,0 +1,24 @@ +# Wizard Kit: Enter SafeMode by editing the BCD + +import os + +# Init +os.chdir(os.path.dirname(os.path.realpath(__file__))) +os.system('title Wizard Kit: SafeMode Tool') +from functions import * + +if __name__ == '__main__': + if ask('Enable booting to SafeMode (with Networking)?'): + # Edit BCD to set safeboot as default + run_program('bcdedit /set {default} safeboot network', check=False) + + # Enable MSI access under safemode + run_program(r'reg add HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\MSIServer /f', check=False) + run_program(r'reg add HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\MSIServer /ve /t REG_SZ /d "Service" /f', check=False) + + ## Done ## + pause('Press Enter to reboot...') + run_program('shutdown -r -t 3', check=False) + + # Quit + quit() \ No newline at end of file diff --git a/.bin/Scripts/safemode_exit.py b/.bin/Scripts/safemode_exit.py new file mode 100644 index 00000000..9a6713f9 --- /dev/null +++ b/.bin/Scripts/safemode_exit.py @@ -0,0 +1,24 @@ +# Wizard Kit: Exit SafeMode by editing the BCD + +import os + +# Init +os.chdir(os.path.dirname(os.path.realpath(__file__))) +os.system('title Wizard Kit: SafeMode Tool') +from functions import * + +if __name__ == '__main__': + if ask('Disable booting to SafeMode?'): + # Edit BCD to remove safeboot value + run_program('bcdedit /deletevalue {current} safeboot', check=False) + run_program('bcdedit /deletevalue {default} safeboot', check=False) + + # Disable MSI access under safemode + run_program(r'reg delete HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\MSIServer /f', check=False) + + ## Done ## + pause('Press Enter to reboot...') + run_program('shutdown -r -t 3', check=False) + + # Quit + quit() \ No newline at end of file diff --git a/.bin/Scripts/sfc_scan.cmd b/.bin/Scripts/sfc_scan.cmd deleted file mode 100644 index 6d8b599d..00000000 --- a/.bin/Scripts/sfc_scan.cmd +++ /dev/null @@ -1,19 +0,0 @@ -@echo off - -:Flags -set fix= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) - if /i "%%f" == "/f" (set fix=/f) -) - -:Init -title Wizard Kit: System File Checker -color 1b - -:ScheduleCheck -sfc /scannow - -:Done -echo Press any key to exit... -pause>nul \ No newline at end of file diff --git a/.bin/Scripts/sfc_scan.py b/.bin/Scripts/sfc_scan.py new file mode 100644 index 00000000..0028fd98 --- /dev/null +++ b/.bin/Scripts/sfc_scan.py @@ -0,0 +1,54 @@ +# Wizard Kit: SFC Tool + +import os +import re + +# Init +os.chdir(os.path.dirname(os.path.realpath(__file__))) +os.system('title Wizard Kit: SFC Tool') +from functions import * +vars_wk = init_vars_wk() +vars_wk.update(init_vars_os()) +vars_wk['LogFile'] = '{LogDir}\\SFC.log'.format(**vars_wk) +vars_wk['Notepad2'] = '{BinDir}\\Notepad2\\Notepad2-Mod.exe'.format(**vars_wk) +if vars_wk['Arch'] == 64: + vars_wk['Notepad2'] = vars_wk['Notepad2'].replace('.exe', '64.exe') +os.makedirs(vars_wk['LogDir'], exist_ok=True) + +def abort(): + print_warning('Aborted.', vars_wk['LogFile']) + pause("Press Enter to exit...") + exit_script() + +def exit_script(): + quit() + +def run_sfc_scan(): + """Run SFC in a "split window" and report errors.""" + print_info('* Checking system file health', vars_wk['LogFile']) + _cmd = [ + '{SYSTEMROOT}\\System32\\sfc.exe'.format(**vars_wk['Env']), + '/scannow'] + _out = run_program(_cmd, check=False, pipe=False) + # Save stderr + # with open('{LogDir}\\SFC.err'.format(**vars_wk), 'a') as f: + # f.write(out.stdout) + # Save stdout + # with open('{LogDir}\\SFC.log'.format(**vars_wk), 'a') as f: + # f.write(out.stdout) + +if __name__ == '__main__': + stay_awake(vars_wk) + run_sfc_scan() + + # Done + print_standard('\nDone.', vars_wk['LogFile']) + pause('Press Enter to exit...') + + # Open log + extract_item('Notepad2', vars_wk, silent=True) + subprocess.Popen([vars_wk['Notepad2'], vars_wk['LogFile']]) + + # Quit + kill_process('caffeine.exe') + exit_script() \ No newline at end of file diff --git a/.bin/Scripts/sw_checklist.py b/.bin/Scripts/sw_checklist.py new file mode 100644 index 00000000..c22edaa7 --- /dev/null +++ b/.bin/Scripts/sw_checklist.py @@ -0,0 +1,396 @@ +# Wizard Kit: Software Diagnostics + +import os +import re +import shutil +import subprocess +import winreg + +# Init +os.chdir(os.path.dirname(os.path.realpath(__file__))) +os.system('title Wizard Kit: Software Checklist Tool') +from functions import * +vars_wk = init_vars_wk() +vars_wk.update(init_vars_os()) +vars_wk['BackupDir'] = '{ClientDir}\\Backups\\{Date}'.format(**vars_wk) +vars_wk['LogFile'] = '{LogDir}\\Software Checklist.log'.format(**vars_wk) +vars_wk['AutoRuns'] = '{BinDir}\\SysinternalsSuite\\autoruns.exe'.format(**vars_wk) +vars_wk['ERUNT'] = '{BinDir}\\erunt\\ERUNT.EXE'.format(**vars_wk) +vars_wk['Everything'] = '{BinDir}\\Everything\\Everything.exe'.format(**vars_wk) +vars_wk['HWiNFO'] = '{BinDir}\\HWiNFO\\HWiNFO.exe'.format(**vars_wk) +vars_wk['Notepad2'] = '{BinDir}\\Notepad2\\Notepad2-Mod.exe'.format(**vars_wk) +vars_wk['ProduKey'] = '{BinDir}\\ProduKey\\ProduKey.exe'.format(**vars_wk) +vars_wk['SIV'] = '{BinDir}\\SIV\\SIV.exe'.format(**vars_wk) +vars_wk['SevenZip'] = '{BinDir}\\7-Zip\\7za.exe'.format(**vars_wk) +vars_wk['XMPlay'] = '{BinDir}\\XMPlay\\xmplay.exe'.format(**vars_wk) +if vars_wk['Arch'] == 64: + vars_wk['AutoRuns'] = vars_wk['AutoRuns'].replace('.exe', '64.exe') + vars_wk['Everything'] = vars_wk['Everything'].replace('.exe', '64.exe') + vars_wk['HWiNFO'] = vars_wk['HWiNFO'].replace('.exe', '64.exe') + vars_wk['Notepad2'] = vars_wk['Notepad2'].replace('.exe', '64.exe') + vars_wk['ProduKey'] = vars_wk['ProduKey'].replace('.exe', '64.exe') + vars_wk['SIV'] = vars_wk['SIV'].replace('.exe', '64.exe') + vars_wk['SevenZip'] = vars_wk['SevenZip'].replace('.exe', '64.exe') +os.makedirs(vars_wk['LogDir'], exist_ok=True) + +def abort(): + print_warning('Aborted.', vars_wk['LogFile']) + exit_script() + +def backup_power_plans(): + """Export current power plans.""" + print_info('* Backing up power plans', vars_wk['LogFile']) + os.makedirs('{BackupDir}\\Power Plans'.format(**vars_wk), exist_ok=True) + try: + _plans = run_program('powercfg /L') + _plans = _plans.stdout.decode().splitlines() + _plans = [p for p in _plans if re.search(r'^Power Scheme', p)] + for p in _plans: + _guid = re.sub(r'Power Scheme GUID:\s+([0-9a-f\-]+).*', r'\1', p) + _name = re.sub(r'Power Scheme GUID:\s+[0-9a-f\-]+\s+\(([^\)]+)\).*', r'\1', p) + print(' {name} ({guid})'.format(guid=_guid, name=_name)) + _out = '{BackupDir}\\Power Plans\\{name}.pow'.format(name=_name, **vars_wk) + if not os.path.exists(_out): + run_program('powercfg /export "{out}" {guid}'.format(out=_out, guid=_guid), check=False) + except subprocess.CalledProcessError: + print_error('ERROR: Failed to export power plans.') + +def backup_registry(): + print_info('* Backing up registry', vars_wk['LogFile']) + extract_item('erunt', vars_wk, silent=True) + _args = [ + '{LogDir}\\Registry'.format(**vars_wk), + 'sysreg', + 'curuser', + 'otherusers', + '/noprogresswindow'] + try: + run_program(vars_wk['ERUNT'], _args) + except subprocess.CalledProcessError: + print_error('ERROR: Failed to backup registry', vars_wk['LogFile']) + +def cleanup_adwcleaner(): + _path = '{SYSTEMDRIVE}\\AdwCleaner'.format(**vars_wk['Env']) + if os.path.exists(_path): + try: + print_info('* Uninstalling AdwCleaner', vars_wk['LogFile']) + os.makedirs('{ClientDir}\\Info'.format(**vars_wk), exist_ok=True) + for entry in os.scandir(_path): + if entry.is_file() and re.search(r'*.(log|txt)', entry.name): + shutil.move(entry.path, '{ClientDir}\\Info\\{name}'.format(name=entry.name, **vars_wk)) + elif entry.name == 'Quarantine': + os.makedirs('{ClientDir}\\Quarantine'.format(**vars_wk), exist_ok=True) + shutil.move(entry.path, '{ClientDir}\\Quarantine\\AdwCleaner'.format(**vars_wk)) + shutil.rmtree(_path) + except: + print_error('ERROR: Failed to uninstall AdwCleaner.', vars_wk['LogFile']) + +def cleanup_desktop(): + print_info('* Checking Desktop for leftover files', vars_wk['LogFile']) + os.makedirs('{ClientDir}\\Info'.format(**vars_wk), exist_ok=True) + for entry in os.scandir('{USERPROFILE}\\Desktop'.format(**vars_wk['Env'])): + # JRT, RKill, Shortcut cleaner + if re.search(r'^((JRT|RKill).*|sc-cleaner)', entry.name, re.IGNORECASE): + shutil.move(entry.path, '{ClientDir}\\Info\\{name}'.format(name=entry.name, **vars_wk)) + run_program('rmdir "{path}"'.format(path='{ClientDir}\\Info'.format(**vars_wk)), check=False, shell=True) + +def exit_script(): + # pause("Press Enter to exit...") + quit() + +def get_battery_info(): + #~#print_info('* Battery', vars_wk['LogFile']) + #~#WK-write "==== Battery Check ====" "$log" + #~#& "$wd\check_battery.ps1" "$log" + #~#WK-write "" "$log" + pass + +def get_free_space(): + print_info('* Free space', vars_wk['LogFile']) + for drive in get_free_space_info(): + print_standard(' {} {}'.format(*drive)) + +def get_installed_ram(): + print_info('* Installed RAM', vars_wk['LogFile']) + with open ('{LogDir}\\RAM Information (SIV).txt'.format(**vars_wk), 'r', encoding='utf16') as f: + for line in f.readlines(): + if re.search(r'^Memory', line, re.IGNORECASE): + print_standard(' ' + line.strip(), vars_wk['LogFile']) + +def get_os_info(): + print_info('* Operating System', vars_wk['LogFile']) + if vars_wk['Arch'] == 32: + # Show all 32-bit installs as an error message + print_error(' {Name} x{Arch}'.format(**vars_wk), vars_wk['LogFile']) + else: + if vars_wk['CurrentVersion'] == '6.0': + # Vista + if vars_wk['CurrentBuildNumber'] < 6002: + print_error(' {Name} x{Arch} (very outdated)'.format(**vars_wk), vars_wk['LogFile']) + else: + print_warning(' {Name} x{Arch}'.format(**vars_wk), vars_wk['LogFile']) + elif vars_wk['CurrentVersion'] == '6.1': + # Windows 7 + if vars_wk['CSDVersion'] == 'Service Pack 1': + print_standard(' {Name} x{Arch}'.format(**vars_wk), vars_wk['LogFile']) + else: + print_error(' {Name} x{Arch} (very outdated)'.format(**vars_wk), vars_wk['LogFile']) + elif vars_wk['CurrentVersion'] == '6.2': + # Windows 8 + print_error(' {Name} x{Arch} (very outdated)'.format(**vars_wk), vars_wk['LogFile']) + elif vars_wk['CurrentVersion'] == '6.3': + if vars_wk['CurrentBuild'] == 9200: + # Windows 8.1 + print_error(' {Name} x{Arch} (very outdated)'.format(**vars_wk), vars_wk['LogFile']) + elif vars_wk['CurrentBuild'] == 9600: + # Windows 8.1 Update + print_info(' {Name} x{Arch}'.format(**vars_wk), vars_wk['LogFile']) + elif vars_wk['CurrentBuild'] == 10240: + # Windows 10 Threshold 1 + print_error(' {Name} x{Arch} (outdated)'.format(**vars_wk), vars_wk['LogFile']) + elif vars_wk['CurrentBuild'] == 10586: + # Windows 10 Threshold 2 + print_warning(' {Name} x{Arch} (outdated)'.format(**vars_wk), vars_wk['LogFile']) + elif vars_wk['CurrentBuild'] == 14393: + # Windows 10 Redstone 1 + print_standard(' {Name} x{Arch}'.format(**vars_wk), vars_wk['LogFile']) + else: + print_warning(' {Name} x{Arch} (unrecognized)'.format(**vars_wk), vars_wk['LogFile']) + # OS Activation + if re.search(r'permanent', vars_wk['Activation'], re.IGNORECASE): + print_standard(' {Activation}'.format(**vars_wk)) + elif re.search(r'unavailable', vars_wk['Activation'], re.IGNORECASE): + print_warning(' {Activation}'.format(**vars_wk)) + else: + print_error(' {Activation}'.format(**vars_wk)) + +def get_ticket_number(): + """Get TicketNumber from user and save it in the info folder.""" + vars_wk['TicketNumber'] = None + while vars_wk['TicketNumber'] is None: + _ticket = input('Enter ticket number: ') + if re.match(r'^([0-9]+([-_]?\w+|))$', _ticket): + vars_wk['TicketNumber'] = _ticket + with open('{LogDir}\\TicketNumber'.format(**vars_wk), 'w') as f: + f.write(_ticket) + else: + print_error('ERROR: Invalid ticket number', vars_wk['LogFile']) + +def get_user_data_summary(): + print_info('* User Data', vars_wk['LogFile']) + users = get_user_data_size_info(vars_wk) + for user in sorted(users): + print_standard(' User: {user}'.format(user=user), vars_wk['LogFile']) + print_standard(' ' + users[user].get('ProfileSize', 'Unknown'), vars_wk['LogFile']) + print_standard(' -------------------------------', vars_wk['LogFile']) + for folder in sorted(users[user]['Shell Folders']): + print_standard(' ' + users[user]['Shell Folders'][folder], vars_wk['LogFile']) + for folder in sorted(users[user]['Extra Folders']): + print_standard(' ' + users[user]['Shell Folders'][folder], vars_wk['LogFile']) + +def run_hwinfo_sensors(): + _path = '{BinDir}\\HWiNFO'.format(**vars_wk) + for bit in [32, 64]: + # Configure + _source = '{path}\\general.ini'.format(path=_path) + _dest = '{path}\\HWiNFO{bit}.ini'.format(bit=bit, path=_path) + shutil.copy(_source, _dest) + with open(_dest, 'a') as f: + f.write('SensorsOnly=1\n') + f.write('SummaryOnly=0\n') + subprocess.Popen(vars_wk['HWiNFO']) + +def run_produkey(): + extract_item('ProduKey', vars_wk, silent=True) + if not os.path.exists('{LogDir}\\Product Keys (ProduKey).txt'.format(**vars_wk)): + print_info('* Saving product keys (secondary method)', vars_wk['LogFile']) + # Clear current configuration + for config in ['ProduKey.cfg', 'ProduKey64.cfg']: + try: + if os.path.exists('{BinDir}\\ProduKey\\{config}'.format(config=config, **vars_wk)): + os.remove('{BinDir}\\ProduKey\\{config}'.format(config=config, **vars_wk)) + except: + pass + _args = ['/nosavereg', '/stext', '{LogDir}\\Product Keys (ProduKey).txt'.format(**vars_wk)] + run_program(vars_wk['ProduKey'], _args, check=False) + +def run_siv(): + extract_item('SIV', vars_wk, silent=True) + # All system info + if not os.path.exists('{LogDir}\\System Information (SIV).txt'.format(**vars_wk)): + print_info('* Saving System information', vars_wk['LogFile']) + _cmd = [ + vars_wk['SIV'], + '-KEYS', + '-LOCAL', + '-UNICODE', + '-SAVE={LogDir}\\System_Information_(SIV).txt'.format(**vars_wk)] + run_program(_cmd, check=False) + + # RAM + if not os.path.exists('{LogDir}\\RAM_Information_(SIV).txt'.format(**vars_wk)): + _args = [ + '-KEYS', + '-LOCAL', + '-UNICODE', + '-SAVE=[dimms]={LogDir}\\RAM_Information_(SIV).txt'.format(**vars_wk)] + run_program(vars_wk['SIV'], _args, check=False) + + # Installed Programs + if not os.path.exists('{LogDir}\\Installed Program List_(SIV).txt'.format(**vars_wk)): + print_info('* Saving installed program list', vars_wk['LogFile']) + _args = [ + '-KEYS', + '-LOCAL', + '-UNICODE', + '-SAVE=[software]={LogDir}\\Installed_Program_List_(SIV).txt'.format(**vars_wk)] + run_program(vars_wk['SIV'], _args, check=False) + + # Product Keys + if not os.path.exists('{LogDir}\\Product Keys (SIV).txt'.format(**vars_wk)): + print_info('* Saving product keys', vars_wk['LogFile']) + _args = [ + '-KEYS', + '-LOCAL', + '-UNICODE', + '-SAVE=[product-ids]={LogDir}\\Product_Keys_(SIV).txt'.format(**vars_wk)] + run_program(vars_wk['SIV'], _args, check=False) + extract_item('ProduKey', vars_wk, silent=True) + + # Rename files + for item in os.scandir(vars_wk['LogDir']): + if re.search(r'SIV', item.name, re.IGNORECASE): + shutil.move(item.path, item.path.replace('_', ' ').title().replace('Siv', 'SIV')) + +def run_xmplay(): + extract_item('XMPlay', vars_wk, silent=True) + subprocess.Popen([vars_wk['XMPlay'], '{BinDir}\\XMPlay\\music.7z'.format(**vars_wk)]) + +def uninstall_eset(): + if 'PROGRAMFILES(X86)' in vars_wk['Env']: + _path = '{PROGRAMFILES(X86)}\\ESET'.format(**vars_wk['Env']) + else: + _path = '{PROGRAMFILES}\\ESET'.format(**vars_wk['Env']) + if os.path.exists('{path}\\ESET Online Scanner'.format(path=_path)): + try: + print_info('* Uninstalling ESET Online Scanner', vars_wk['LogFile']) + run_program('"{path}\\ESET Online Scanner\\OnlineScannerUninstaller.exe" -s'.format(path=_path)) + shutil.rmtree('{path}\\ESET Online Scanner'.format(path=_path)) + run_program('rmdir "{path}"'.format(path=_path), check=False) + except: + print_error('ERROR: Failed to uninstall ESET Online Scanner.', vars_wk['LogFile']) + +def uninstall_mbam(): + if 'PROGRAMFILES(X86)' in vars_wk['Env']: + _path = '{PROGRAMFILES(X86)}\\Malwarebytes Anti-Malware'.format(**vars_wk['Env']) + else: + _path = '{PROGRAMFILES}\\Malwarebytes Anti-Malware'.format(**vars_wk['Env']) + if os.path.exists('{path}'.format(path=_path)): + print_warning('* Malwarebytes Anti-Malware installed.', vars_wk['LogFile']) + if ask(' Uninstall?', vars_wk['LogFile']): + try: + run_program('"{path}\\unins000.exe" /SILENT'.format(path=_path)) + run_program('rmdir "{path}"'.format(path=_path), check=False) + except: + print_error('ERROR: Failed to uninstall Malwarebytes Anti-Malware.', vars_wk['LogFile']) + +def uninstall_sas(): + # It is always in programfiles (not x86) ?? + _path = '{PROGRAMFILES}\\SUPERAntiSpyware'.format(**vars_wk['Env']) + if os.path.exists(_path): + print_warning('* SUPERAntiSpyware installed.', vars_wk['LogFile']) + if ask(' Uninstall?', vars_wk['LogFile']): + try: + run_program('{path}\\Uninstall.exe'.format(path=_path)) + run_program('rmdir "{path}"'.format(path=_path), check=False) + except: + print_error('ERROR: Failed to uninstall SUPERAntiSpyware.', vars_wk['LogFile']) + +def update_clock(): + # Set Timezone and sync clock + print_info('* Updating system clock', vars_wk['LogFile']) + try: + run_program('tzutil /s "Pacific Standard Time"', check=False) + run_program('net stop w32ime', check=False) + run_program('w32tm /config /syncfromflags:manual /manualpeerlist:"us.pool.ntp.org time.nist.gov time.windows.com"', check=False) + run_program('net start w32ime', check=False) + run_program('w32tm /resync /nowait', check=False) + except: + print_error('ERROR: Failed to update system clock to PST/PDT', vars_wk['LogFile']) + +def upload_info(): + print_info('* Uploading info to NAS', vars_wk['LogFile']) + path = '{ClientDir}'.format(**vars_wk) + file = 'Info_{Date-Time}.7z'.format(**vars_wk) + + # Compress Info + _cmd = [ + vars_wk['SevenZip'], + 'a', '-t7z', '-mx=9', '-bso0', '-bse0', + '{path}\\{file}'.format(path=path, file=file), + '{ClientDir}\\Info'.format(**vars_wk)] + try: + run_program(_cmd, pipe=False) + except subprocess.CalledProcessError: + print_error(' ERROR: Failed to compress data for upload.', vars_wk['LogFile']) + return + + # Upload Info + try: + upload_data(path, file, vars_wk) + except: + print_error(' ERROR: Failed to upload info.', vars_wk['LogFile']) + +if __name__ == '__main__': + stay_awake(vars_wk) + get_ticket_number() + os.system('cls') + print_info('Starting Software Checklist for Ticket #{TicketNumber}\n'.format(**vars_wk), vars_wk['LogFile']) + + # Cleanup + cleanup_desktop() + cleanup_adwcleaner() + uninstall_eset() + uninstall_mbam() + uninstall_sas() + + # Last-minute backups and adjustments + update_clock() + backup_power_plans() + backup_registry() + run_siv() + run_produkey() + + ## System information ## + get_user_data_summary() + get_os_info() + if 'The machine is permanently activated.' not in vars_wk['Activation']: + subprocess.Popen('slui') + get_free_space() + get_installed_ram() + get_battery_info() + + # Play audio, show devices, and open Windows updates + subprocess.Popen('devmgmt.msc', shell=True) + run_hwinfo_sensors() + if vars_wk['Version'] == '10': + subprocess.Popen('control /name Microsoft.WindowsUpdate', shell=True) + else: + subprocess.Popen('wuapp', shell=True) + sleep(3) + run_xmplay() + + # Upload info + upload_info() + + # Done + print_standard('\nDone.', vars_wk['LogFile']) + pause('Press Enter exit...') + + # Open log + extract_item('Notepad2', vars_wk) + subprocess.Popen([vars_wk['Notepad2'], vars_wk['LogFile']]) + + # Quit + kill_process('caffeine.exe') + exit_script() \ No newline at end of file diff --git a/.bin/Scripts/sw_diagnostics.ps1 b/.bin/Scripts/sw_diagnostics.ps1 deleted file mode 100644 index c8bff9a8..00000000 --- a/.bin/Scripts/sw_diagnostics.ps1 +++ /dev/null @@ -1,354 +0,0 @@ -# Wizard Kit: Software Diagnostics - -## Init ## -$wd = $(Split-Path $MyInvocation.MyCommand.Path) -pushd "$wd" -. .\init.ps1 -clear -$host.UI.RawUI.WindowTitle = "Wizard Kit: Diagnostics Tool" -$backup_path = "$ClientPath\Backups\$username\$date" -$logpath = "$ClientPath\Info\$date" -md "$backup_path" 2>&1 | out-null -md "$logpath" 2>&1 | out-null -$log = "$logpath\Diagnostics.log" -$bin = (Get-Item $wd).Parent.FullName -$diag_dest = "/srv/Diagnostics" -$diag_server = "10.0.0.10" -$diag_user = "wkdiag" -$conemu = "$bin\ConEmu\ConEmu.exe" -$sz = "$bin\7-Zip\7za.exe" -$produkey = "$bin\tmp\ProduKey.exe" -$siv = "$bin\SIV\SIV.exe" - -# OS Check -. .\check_os.ps1 -if ($arch -eq 64) { - $conemu = "$bin\ConEmu\ConEmu64.exe" - $sz = "$bin\7-Zip\7za64.exe" - $produkey = "$bin\tmp\ProduKey64.exe" - $siv = "$bin\SIV\SIV64.exe" -} - -# Set Service Order -while ($service_order -notmatch '^\d+') { - $service_order = read-host "Please enter the service order number" - if ($service_order -notmatch '^\d+') { - write-host "ERROR: Invalid SO`r`n" -foreground "red" - } -} -clear -out-file -filepath "$logpath\TicketNumber" -inputobject $service_order -append -WK-write "Starting SW diagnostics for Ticket #$service_order" "$log" -WK-write "" "$log" - -## Sanitize Environment ## -#~# BROKEN #~# -#~# # ProcessKiller -#~# # adapted from TronScript (reddit.com/r/TronScript) and credit to /u/cuddlychops06 -#~# #WK-write "* Stopping all processes" "$log" -#~# taskkill.exe /F /FI "USERNAME eq Demo" /FI "IMAGENAME ne ClassicShellService.exe" /FI "IMAGENAME ne explorer.exe" /FI "IMAGENAME ne dwm.exe" /FI "IMAGENAME ne cmd.exe" /FI "IMAGENAME ne Taskmgr.exe" /FI "IMAGENAME ne MsMpEng.exe" /FI "IMAGENAME ne powershell.exe" /FI "IMAGENAME ne rkill.exe" /FI "IMAGENAME ne rkill64.exe" /FI "IMAGENAME ne rkill.com" /FI "IMAGENAME ne rkill64.com" /FI "IMAGENAME ne conhost.exe" /FI "IMAGENAME ne dashost.exe" /FI "IMAGENAME ne vmtoolsd.exe" /FI "IMAGENAME ne conhost.exe" 2>&1 | out-null - -# RKill -WK-write "* Running RKill" "$log" -start -wait "$conemu" -argumentlist @("/cmd", "$bin\RKill\RKill.exe", "-l", "$logpath\rkill.log") -if (!(ask "Did RKill run correctly?" "$log")) { - start -wait "$conemu" -argumentlist @("/cmd", "$bin\RKill\explorer.exe", "-l", "$logpath\rkill.log") - if (!(ask "Did RKill run correctly?" "$log")) { - WK-warn "Since RKill has failed to run, please try an alternative version." "$log" - WK-warn "Opening RKill folder..." "$log" - WK-write "" "$log" - sleep -s 2 - ii "$bin\RKill\" - pause - } -} - -# TDSSKiller Rootkit scan -WK-write "* Running Rootkit scan" "$log" -if (test-path "$bin\TDSSKiller.exe") { - md "$ClientPath\Quarantine\TDSSKiller" 2>&1 | out-null - start -wait "$bin\TDSSKiller.exe" -argumentlist @("-l", "$logpath\TDSSKiller.log", "-qpath", "$ClientPath\Quarantine\TDSSKiller", "-accepteula", "-accepteulaksn", "-dcexact", "-tdlfs") -} else { - WK-error " TDSSKiller.exe missing. Please verify Wizard-Kit was copied correctly." -} - -## Network Check ## -WK-write "* Testing Internet Connection" "$log" -while (!(test-connection "google.com" -count 2 -quiet)) { - WK-warn "System appears offline. Please connect to the internet." "$log" - if (!(ask "Try again?" "$log")) { - WK-error "System still appears offline; aborting script." "$log" - exit 1 - } -} - -## Misc Configuration ## -# Export current power plans -$pow_backup_path = "$ClientPath\Backups\$date\Power Plans" -md "$pow_backup_path" > $null 2>&1 | out-null -foreach ($plan in (powercfg /L)) { - if ($plan -imatch '^Power Scheme.*') { - $guid = $plan -replace 'Power Scheme GUID:\s+([0-9a-f\-]+).*', '$1' - $name = $plan -replace 'Power Scheme GUID:\s+[0-9a-f\-]+\s+\(([^\)]+)\).*', '$1' - $set = ($plan -imatch '.*\*$') - if (!(test-path "$pow_backup_path\$name.pow")) { - powercfg /export "$pow_backup_path\$name.pow" $guid - } - } -} - -# Change Power Plan -WK-write "* Changing power plan to 'High Performance'" "$log" -start "powercfg.exe" -argumentlist @("-restoredefaultschemes") -nonewwindow -redirectstandardoutput out-null -start -wait "powercfg" -argumentlist @("-setactive", "8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c") -nonewwindow -redirectstandardoutput out-null - -## Begin Diagnostics ## -# Infection Scan -WK-write "* Starting background infection scan" "$log" -if ($arch -eq 64) { - $prog = "$bin\HitmanPro\HitmanPro64.exe" -} else { - $prog = "$bin\HitmanPro\HitmanPro.exe" -} -start $prog -argumentlist @("/quiet", "/noinstall", "/noupload", "/log=$logpath\hitman.xml") -workingdirectory "$bin\HitmanPro" - -#~# BROKEN #~# -#~# # OS Health Checks -#~# ## DISM -#~# if ($win_version -match '^8|10$') { -#~# start "$conemu" -argumentlist @("/cmd", "$windir\System32\dism.exe", "/online", "/cleanup-image", "/checkhealth", "/logpath:$logpath\DISM.log", "-new_console:c") -#~# } -#~# ## SFC -#~# start "$conemu" -argumentlist @("/cmd", "$windir\System32\sfc.exe", "/scannow", "-new_console:c") -#~# ## CHKDSK -#~# start "$conemu" -argumentlist @("/cmd", "$windir\System32\chkdsk.exe", "$systemdrive", "-new_console:c") - -# Backup Registry -if (!(test-path "$logpath\Registry")) { - WK-write "* Backing up registry" "$log" - start -wait "$bin\Erunt\ERUNT.EXE" -argumentlist @("$logpath\Registry", "sysreg", "curuser", "otherusers", "/noprogresswindow") -workingdirectory "$bin\Erunt" -} - -# Backup Browsers -if (test-path "$localappdata\Google\Chrome") { - WK-write "* Backing up Google Chrome" "$log" - pushd "$localappdata\Google\Chrome" - $sz_args = @( - "a", "-t7z", "-mx=1", - "$backup_path\Chrome.7z", - '"User Data"') - start $sz -argumentlist $sz_args -wait -windowstyle minimized - popd -} -if (test-path "$appdata\Mozilla\Firefox") { - WK-write "* Backing up Mozilla Firefox" "$log" - pushd "$appdata\Mozilla\Firefox" - $sz_args = @( - "a", "-t7z", "-mx=1", - "$backup_path\Firefox.7z", - "Profiles", - "profiles.ini") - start $sz -argumentlist $sz_args -wait -windowstyle minimized - popd -} -if (test-path "$userprofile\Favorites") { - WK-write "* Backing up Internet Explorer" "$log" - pushd "$userprofile" - $sz_args = @( - "a", "-t7z", "-mx=1", - "$backup_path\IE Favorites.7z", - "Favorites") - start $sz -argumentlist $sz_args -wait -windowstyle minimized - popd -} - -# Get total size of temporary files -if (!(test-path "$logpath\bleachbit.log")) { - WK-write "* Checking for temporary files" "$log" - start -wait "$bin\BleachBit\bleachbit_console.exe" -argumentlist @("--preview", "--preset") -nonewwindow -workingdirectory "$bin\BleachBit" -redirectstandarderror "$logpath\bleachbit.err" -redirectstandardoutput "$logpath\bleachbit.log" -} - -# Autoruns -if (!(test-path "$logpath\autoruns.arn")) { - WK-write "* Starting background autoruns scan" "$log" - New-Item -Path "HKCU:\Software\Sysinternals\AutoRuns" -Force 2>&1 | out-null - Set-ItemProperty -Path "HKCU:\Software\Sysinternals\AutoRuns" -Name "checkvirustotal" -Value 1 -Type "DWord" | out-null - Set-ItemProperty -Path "HKCU:\Software\Sysinternals\AutoRuns" -Name "EulaAccepted" -Value 1 -Type "DWord" | out-null - Set-ItemProperty -Path "HKCU:\Software\Sysinternals\AutoRuns" -Name "shownomicrosoft" -Value 1 -Type "DWord" | out-null - Set-ItemProperty -Path "HKCU:\Software\Sysinternals\AutoRuns" -Name "shownowindows" -Value 1 -Type "DWord" | out-null - Set-ItemProperty -Path "HKCU:\Software\Sysinternals\AutoRuns" -Name "showonlyvirustotal" -Value 1 -Type "DWord" | out-null - Set-ItemProperty -Path "HKCU:\Software\Sysinternals\AutoRuns" -Name "submitvirustotal" -Value 0 -Type "DWord" | out-null - Set-ItemProperty -Path "HKCU:\Software\Sysinternals\AutoRuns" -Name "verifysignatures" -Value 1 -Type "DWord" | out-null - New-Item "HKCU:\Software\Sysinternals\AutoRuns\SigCheck" 2>&1 | out-null - Set-ItemProperty -Path "HKCU:\Software\Sysinternals\AutoRuns\SigCheck" -Name "EulaAccepted" -Value 1 -Type "DWord" | out-null - New-Item "HKCU:\Software\Sysinternals\AutoRuns\Streams" 2>&1 | out-null - Set-ItemProperty -Path "HKCU:\Software\Sysinternals\AutoRuns\Streams" -Name "EulaAccepted" -Value 1 -Type "DWord" | out-null - New-Item "HKCU:\Software\Sysinternals\AutoRuns\VirusTotal" 2>&1 | out-null - Set-ItemProperty -Path "HKCU:\Software\Sysinternals\AutoRuns\VirusTotal" -Name "VirusTotalTermsAccepted" -Value 1 -Type "DWord" | out-null - start "$bin\SysinternalsSuite\autoruns.exe" -workingdirectory "$bin\SysinternalsSuite" -windowstyle "minimized" -} - -# AIDA64 -if (!(test-path "$logpath\keys-aida64.txt")) { - WK-write "* Running AIDA64 (Product Keys)" "$log" - start -wait "$bin\AIDA64\aida64.exe" -argumentlist @("/R", "$logpath\keys-aida64.txt", "/CUSTOM", "$bin\AIDA64\licenses.rpf", "/TEXT", "/SILENT", "/SAFEST") -workingdirectory "$bin\AIDA64" -} - -if (!(test-path "$logpath\program_list-aida64.txt")) { - WK-write "* Running AIDA64 (SW listing)" "$log" - start -wait "$bin\AIDA64\aida64.exe" -argumentlist @("/R", "$logpath\program_list-aida64.txt", "/CUSTOM", "$bin\AIDA64\installed_programs.rpf", "/TEXT", "/SILENT", "/SAFEST") -workingdirectory "$bin\AIDA64" -} - -if (!(test-path "$logpath\aida64.htm")) { - WK-write "* Running AIDA64 (Full listing) in background" "$log" - start "$bin\AIDA64\aida64.exe" -argumentlist @("/R", "$logpath\aida64.html", "/CUSTOM", "$bin\AIDA64\full.rpf", "/HTML", "/SILENT") -workingdirectory "$bin\AIDA64" -} - -# SIV -if (!(test-path "$logpath\keys-siv.txt")) { - WK-write "* Running SIV (Product Keys)" "$log" - start -wait "$siv" -argumentlist @("-KEYS", "-LOCAL", "-UNICODE", "-SAVE=[product-ids]=$logpath\keys-siv.txt") -workingdirectory "$bin\SIV" -} - -if (!(test-path "$logpath\program_list-siv.txt")) { - WK-write "* Running SIV (SW listing)" "$log" - start -wait "$siv" -argumentlist @("-KEYS", "-LOCAL", "-UNICODE", "-SAVE=[software]=$logpath\program_list-siv.txt") -workingdirectory "$bin\SIV" -} - -if (!(test-path "$logpath\aida64.htm")) { - WK-write "* Running SIV (Full listing) in background" "$log" - start -wait "$siv" -argumentlist @("-KEYS", "-LOCAL", "-UNICODE", "-SAVE=$logpath\siv.txt") -workingdirectory "$bin\SIV" -} - -# Product Keys -## Extract -md "$bin\tmp" 2>&1 | out-null -start -wait $sz -argumentlist @("e", "$bin\ProduKey.7z", "-otmp", "-aoa", "-pAbracadabra", "-bsp0", "-bso0") -workingdirectory "$bin" -nonewwindow -rm "$bin\tmp\ProduKey*.cfg" -sleep -s 1 - -## Run -if (!(test-path "$logpath\keys-produkey.txt")) { - WK-write "* Saving Product Keys" "$log" - start -wait $produkey -argumentlist @("/nosavereg", "/stext", "$logpath\keys-produkey.txt") -workingdirectory "$bin\tmp" -} - -## Summary ## -WK-write "" "$log" - -# Removed temp file size -WK-write "==== Temp Files ====" "$log" -$bb = (gc "$logpath\bleachbit.log") -imatch '^(disk space.*recovered|files.*deleted)' -foreach ($_ in $bb) { - $_ = " " + $_ - WK-write $_ "$log" -} -WK-write "" "$log" - -# Free Space -WK-write "==== Free Space ====" "$log" -& "$wd\free_space.ps1" "$log" -WK-write "" "$log" - -# RAM -WK-write "==== RAM ====" "$log" -& "$wd\installed_ram.ps1" "$log" -WK-write "" "$log" - -# List installed Office programs -WK-write "==== Installed Office Programs ====" "$log" -$installed_office = (gc "$logpath\program_list-aida64.txt") -imatch 'Office' | sort -foreach ($_ in $installed_office) { - $_ = $_ -ireplace '^\s+(.*?)\s\s+.*', '$1' - WK-write " $_" "$log" -} -WK-write "" "$log" - -# Saved keys -WK-write "==== Found Product Keys ====" "$log" -$keys = (gc "$logpath\keys-produkey.txt") -imatch '(product.name)' -foreach ($_ in $keys) { - $_ = $_ -ireplace '^product name\s+: ', ' ' - WK-write $_ "$log" -} -WK-write "" "$log" - - -# OS Info -WK-write "==== Operating System ====" "$log" -if ($arch -eq 32) { - WK-error " $os_name x$arch" "$log" -} elseif ($win_info.CurrentVersion -match "6.0") { - if ($win_info.CurrentBuildNumber -match "6002") { - WK-warn " $os_name x$arch" "$log" - } elseif ($win_info.CurrentBuildNumber -match "6001") { - WK-error " $os_name x$arch (very out of date)" "$log" - } elseif ($win_info.CurrentBuildNumber -match "6000") { - WK-error " $os_name x$arch (very out of date)" "$log" - } -} elseif ($win_info.CurrentVersion -match "6.2") { - WK-error " $os_name x$arch (very out of date)" "$log" -} elseif ($win_info.CurrentBuildNumber -match "10240") { - WK-error " $os_name x$arch (Release 1511 not installed)" "$log" -} else { - WK-write " $os_name x$arch" "$log" -} -if ($win_act -imatch 'unavailable') { - WK-warn "$win_act" "$log" -} elseif ($win_act -notmatch "permanent") { - WK-error "$win_act" "$log" -} else { - WK-write "$win_act" "$log" -} -WK-write "" "$log" - -# Updates Check -# TODO: Finish and test this -#WK-write "==== Windows Updates ====" "$log" -#import-module "$bin\Scripts\PSWindowsUpdate" -# Check last install date -#get-wuhistory | sort-object date -descending | select-object -first 1 -# Check if installs CS -# TODO -# Return avail updates -#get-wulist -#WK-write "" "$log" - -# Battery Check -WK-write "==== Battery Check ====" "$log" -& "$wd\check_battery.ps1" "$log" -WK-write "" "$log" - -# User Data -WK-write "==== User Data ====" "$log" -& "$wd\user_data.ps1" "$log" -WK-write "" "$log" - -# Upload info -write-host "Uploading info to NAS..." - -## Write batch -$batch = "lcd `"{0}`"`r`n" -f $ClientPath -$batch += "cd `"{0}`"`r`n" -f $diag_dest -$batch += "put -r Info `"{0}`"`r`n" -f $service_order -out-file -encoding "ASCII" -filepath "$wd\psftp_batch" -inputobject $batch - -## Upload files -$psftp_args = @( - "-noagent", - "-i", "$bin\PuTTY\WK.ppk", - "$diag_user@$diag_server", - "-b", "$wd\psftp_batch") -start "$bin\PuTTY\PSFTP.exe" -argumentlist $psftp_args -wait -windowstyle minimized - -## Done ## -popd -pause "Press Enter to exit..." - -# Open log -$notepad2 = "$bin\Notepad2\Notepad2-Mod.exe" -if (test-path $notepad2) { - start "$notepad2" -argumentlist $log -} else { - start "notepad" -argumentlist $log -} diff --git a/.bin/Scripts/sw_diagnostics.py b/.bin/Scripts/sw_diagnostics.py new file mode 100644 index 00000000..0ff6d62b --- /dev/null +++ b/.bin/Scripts/sw_diagnostics.py @@ -0,0 +1,573 @@ +# Wizard Kit: Software Diagnostics + +import os +import re +import subprocess +import winreg + +# Init +os.chdir(os.path.dirname(os.path.realpath(__file__))) +os.system('title Wizard Kit: Software Diagnostics Tool') +from functions import * +vars_wk = init_vars_wk() +vars_wk.update(init_vars_os()) +vars_wk['BackupDir'] = '{ClientDir}\\Backups\\{Date}'.format(**vars_wk) +vars_wk['LogFile'] = '{LogDir}\\Software Diagnostics.log'.format(**vars_wk) +vars_wk['AutoRuns'] = '{BinDir}\\SysinternalsSuite\\autoruns.exe'.format(**vars_wk) +vars_wk['BleachBit'] = '{BinDir}\\BleachBit\\bleachbit_console.exe'.format(**vars_wk) +vars_wk['ERUNT'] = '{BinDir}\\erunt\\ERUNT.EXE'.format(**vars_wk) +vars_wk['Everything'] = '{BinDir}\\Everything\\Everything.exe'.format(**vars_wk) +vars_wk['HitmanPro'] = '{BinDir}\\HitmanPro\\HitmanPro.exe'.format(**vars_wk) +vars_wk['Notepad2'] = '{BinDir}\\Notepad2\\Notepad2-Mod.exe'.format(**vars_wk) +vars_wk['ProduKey'] = '{BinDir}\\ProduKey\\ProduKey.exe'.format(**vars_wk) +vars_wk['SIV'] = '{BinDir}\\SIV\\SIV.exe'.format(**vars_wk) +vars_wk['SevenZip'] = '{BinDir}\\7-Zip\\7za.exe'.format(**vars_wk) +if vars_wk['Arch'] == 64: + vars_wk['AutoRuns'] = vars_wk['AutoRuns'].replace('.exe', '64.exe') + vars_wk['Everything'] = vars_wk['Everything'].replace('.exe', '64.exe') + vars_wk['HitmanPro'] = vars_wk['HitmanPro'].replace('.exe', '64.exe') + vars_wk['Notepad2'] = vars_wk['Notepad2'].replace('.exe', '64.exe') + vars_wk['ProduKey'] = vars_wk['ProduKey'].replace('.exe', '64.exe') + vars_wk['SIV'] = vars_wk['SIV'].replace('.exe', '64.exe') + vars_wk['SevenZip'] = vars_wk['SevenZip'].replace('.exe', '64.exe') +os.makedirs(vars_wk['LogDir'], exist_ok=True) + +def abort(): + print_warning('Aborted.', vars_wk['LogFile']) + pause("Press Enter to exit...") + exit_script() + +def backup_browsers(): + print_info('* Backing up browser data', vars_wk['LogFile']) + # Chromium + if os.path.exists('{LOCALAPPDATA}\\Chromium'.format(**vars_wk['Env'])): + print_standard(' Chromium', vars_wk['LogFile']) + _cmd = '{SevenZip} a -aoa -bso0 -bse0 -mx=1 "{BackupDir}\\Browsers\\{USERNAME}\\Chromium.7z" "{LOCALAPPDATA}\\Chromium"'.format(**vars_wk, **vars_wk['Env']) + run_program(_cmd, check=False, pipe=False) + # Google Chrome + if os.path.exists('{LOCALAPPDATA}\\Google\\Chrome'.format(**vars_wk['Env'])): + print_standard(' Google Chrome', vars_wk['LogFile']) + _cmd = '{SevenZip} a -aoa -bso0 -bse0 -mx=1 "{BackupDir}\\Browsers\\{USERNAME}\\Google Chrome.7z" "{LOCALAPPDATA}\\Google\\Chrome"'.format(**vars_wk, **vars_wk['Env']) + run_program(_cmd, check=False, pipe=False) + # Internet Explorer + if os.path.exists('{USERPROFILE}\\Favorites'.format(**vars_wk['Env'])): + print_standard(' Internet Explorer', vars_wk['LogFile']) + _cmd = '{SevenZip} a -aoa -bso0 -bse0 -mx=1 "{BackupDir}\\Browsers\\{USERNAME}\\Internet Explorer.7z" "{USERPROFILE}\\Favorites"'.format(**vars_wk, **vars_wk['Env']) + run_program(_cmd, check=False, pipe=False) + run_program('reg export "hkcu\\Software\\Microsoft\\Internet Explorer" "{BackupDir}\\Browsers\\{USERNAME}\\Internet Explorer (HKCU).reg" /y'.format(**vars_wk, **vars_wk['Env']), check=False) + run_program('reg export "hklm\\Software\\Microsoft\\Internet Explorer" "{BackupDir}\\Browsers\\{USERNAME}\\Internet Explorer (HKLM).reg" /y'.format(**vars_wk, **vars_wk['Env']), check=False) + # Mozilla Firefox + if os.path.exists('{APPDATA}\\Mozilla\\Firefox'.format(**vars_wk['Env'])): + print_standard(' Mozilla Firefox', vars_wk['LogFile']) + _cmd = '{SevenZip} a -aoa -bso0 -bse0 -mx=1 "{BackupDir}\\Browsers\\{USERNAME}\\Mozilla Firefox.7z" "{APPDATA}\\Mozilla\\Firefox\\Profile*"'.format(**vars_wk, **vars_wk['Env']) + run_program(_cmd, check=False, pipe=False) + # Opera Chromium + if os.path.exists('{APPDATA}\\Opera Software\\Opera Stable'.format(**vars_wk['Env'])): + print_standard(' Opera Chromium', vars_wk['LogFile']) + _cmd = '{SevenZip} a -aoa -bso0 -bse0 -mx=1 "{BackupDir}\\Browsers\\{USERNAME}\\Opera Chromium.7z" "{APPDATA}\\Mozilla\\Opera Software\\Opera Stable*"'.format(**vars_wk, **vars_wk['Env']) + run_program(_cmd, check=False, pipe=False) + +def backup_file_list(): + """Export current file listing for the system.""" + print_info('* Backing up file list', vars_wk['LogFile']) + extract_item('Everything', vars_wk, silent=True) + _cmd = [ + vars_wk['Everything'], + '-nodb', + '-create-filelist', + '{LogDir}\\File List.txt'.format(**vars_wk), + '{SYSTEMDRIVE}'.format(**vars_wk['Env'])] + try: + run_program(_cmd) + except subprocess.CalledProcessError: + print_error('ERROR: Failed to save file list', vars_wk['LogFile']) + +def backup_power_plans(): + """Export current power plans.""" + print_info('* Backing up power plans', vars_wk['LogFile']) + os.makedirs('{BackupDir}\\Power Plans'.format(**vars_wk), exist_ok=True) + try: + _plans = run_program('powercfg /L') + _plans = _plans.stdout.decode().splitlines() + _plans = [p for p in _plans if re.search(r'^Power Scheme', p)] + for p in _plans: + _guid = re.sub(r'Power Scheme GUID:\s+([0-9a-f\-]+).*', r'\1', p) + _name = re.sub(r'Power Scheme GUID:\s+[0-9a-f\-]+\s+\(([^\)]+)\).*', r'\1', p) + print(' {name} ({guid})'.format(guid=_guid, name=_name)) + _out = '{BackupDir}\\Power Plans\\{name}.pow'.format(name=_name, **vars_wk) + if not os.path.exists(_out): + run_program('powercfg /export "{out}" {guid}'.format(out=_out, guid=_guid), check=False) + except subprocess.CalledProcessError: + print_error('ERROR: Failed to export power plans.') + +def backup_registry(): + print_info('* Backing up registry', vars_wk['LogFile']) + extract_item('erunt', vars_wk, silent=True) + _args = [ + '{LogDir}\\Registry'.format(**vars_wk), + 'sysreg', + 'curuser', + 'otherusers', + '/noprogresswindow'] + try: + run_program(vars_wk['ERUNT'], _args) + except subprocess.CalledProcessError: + print_error('ERROR: Failed to backup registry', vars_wk['LogFile']) + +def exit_script(): + quit() + +def get_battery_info(): + #~#print_info('* Battery', vars_wk['LogFile']) + #~#WK-write "==== Battery Check ====" "$log" + #~#& "$wd\check_battery.ps1" "$log" + #~#WK-write "" "$log" + pass + +def get_free_space(): + print_info('* Free space', vars_wk['LogFile']) + for drive in get_free_space_info(): + print_standard(' {} {}'.format(*drive)) + +def get_installed_office(): + print_info('* Installed Office programs', vars_wk['LogFile']) + with open ('{LogDir}\\Installed Program List (SIV).txt'.format(**vars_wk), 'r', encoding='utf16') as f: + for line in sorted(f.readlines()): + if re.search(r'(Microsoft (Office\s+(365|Enterprise|Home|Pro(\s|fessional)|Single|Small|Standard|Starter|Ultimate|system)|Works[-\s\d]+\d)|(Libre|Open|Star)\s*Office|WordPerfect|Gnumeric|Abiword)', line, re.IGNORECASE): + print_standard(' ' + line[18:96].strip(), vars_wk['LogFile']) + +def get_installed_ram(): + print_info('* Installed RAM', vars_wk['LogFile']) + with open ('{LogDir}\\RAM Information (SIV).txt'.format(**vars_wk), 'r', encoding='utf16') as f: + for line in f.readlines(): + if re.search(r'^Memory', line, re.IGNORECASE): + print_standard(' ' + line.strip(), vars_wk['LogFile']) + +def get_os_info(): + print_info('* Operating System', vars_wk['LogFile']) + if vars_wk['Arch'] == 32: + # Show all 32-bit installs as an error message + print_error(' {Name} x{Arch}'.format(**vars_wk), vars_wk['LogFile']) + else: + if vars_wk['CurrentVersion'] == '6.0': + # Vista + if vars_wk['CurrentBuildNumber'] < 6002: + print_error(' {Name} x{Arch} (very outdated)'.format(**vars_wk), vars_wk['LogFile']) + else: + print_warning(' {Name} x{Arch}'.format(**vars_wk), vars_wk['LogFile']) + elif vars_wk['CurrentVersion'] == '6.1': + # Windows 7 + if vars_wk['CSDVersion'] == 'Service Pack 1': + print_standard(' {Name} x{Arch}'.format(**vars_wk), vars_wk['LogFile']) + else: + print_error(' {Name} x{Arch} (very outdated)'.format(**vars_wk), vars_wk['LogFile']) + elif vars_wk['CurrentVersion'] == '6.2': + # Windows 8 + print_error(' {Name} x{Arch} (very outdated)'.format(**vars_wk), vars_wk['LogFile']) + elif vars_wk['CurrentVersion'] == '6.3': + if vars_wk['CurrentBuild'] == 9200: + # Windows 8.1 + print_error(' {Name} x{Arch} (very outdated)'.format(**vars_wk), vars_wk['LogFile']) + elif vars_wk['CurrentBuild'] == 9600: + # Windows 8.1 Update + print_info(' {Name} x{Arch}'.format(**vars_wk), vars_wk['LogFile']) + elif vars_wk['CurrentBuild'] == 10240: + # Windows 10 Threshold 1 + print_error(' {Name} x{Arch} (outdated)'.format(**vars_wk), vars_wk['LogFile']) + elif vars_wk['CurrentBuild'] == 10586: + # Windows 10 Threshold 2 + print_warning(' {Name} x{Arch} (outdated)'.format(**vars_wk), vars_wk['LogFile']) + elif vars_wk['CurrentBuild'] == 14393: + # Windows 10 Redstone 1 + print_standard(' {Name} x{Arch}'.format(**vars_wk), vars_wk['LogFile']) + else: + print_warning(' {Name} x{Arch} (unrecognized)'.format(**vars_wk), vars_wk['LogFile']) + # OS Activation + if re.search(r'permanent', vars_wk['Activation'], re.IGNORECASE): + print_standard(' {Activation}'.format(**vars_wk)) + elif re.search(r'unavailable', vars_wk['Activation'], re.IGNORECASE): + print_warning(' {Activation}'.format(**vars_wk)) + else: + print_error(' {Activation}'.format(**vars_wk)) + +def get_product_keys(): + print_info('* Product Keys', vars_wk['LogFile']) + # ProduKey + with open ('{LogDir}\\Product Keys (ProduKey).txt'.format(**vars_wk), 'r') as f: + _keys = [] + for line in f.readlines(): + if re.search(r'^Product Name', line): + line = re.sub(r'^Product Name\s+:\s+(.*)', r'\1', line) + _keys.append(line) + for k in sorted(_keys): + print_standard(' ' + k.strip(), vars_wk['LogFile']) + +def get_ticket_number(): + """Get TicketNumber from user and save it in the info folder.""" + vars_wk['TicketNumber'] = None + while vars_wk['TicketNumber'] is None: + _ticket = input('Enter ticket number: ') + if re.match(r'^([0-9]+([-_]?\w+|))$', _ticket): + vars_wk['TicketNumber'] = _ticket + with open('{LogDir}\\TicketNumber'.format(**vars_wk), 'w') as f: + f.write(_ticket) + else: + print_error('ERROR: Invalid ticket number', vars_wk['LogFile']) + +def get_user_data_summary(): + print_info('* User Data', vars_wk['LogFile']) + users = get_user_data_size_info(vars_wk) + for user in sorted(users): + print_standard(' User: {user}'.format(user=user), vars_wk['LogFile']) + print_standard(' ' + users[user].get('ProfileSize', 'Unknown'), vars_wk['LogFile']) + print_standard(' -------------------------------', vars_wk['LogFile']) + for folder in sorted(users[user]['Shell Folders']): + print_standard(' ' + users[user]['Shell Folders'][folder], vars_wk['LogFile']) + for folder in sorted(users[user]['Extra Folders']): + print_standard(' ' + users[user]['Shell Folders'][folder], vars_wk['LogFile']) + +def ping_test(addr='google.com'): + """Attempt to ping addr and if unsuccessful either retry or abort.""" + print_info('* Checking network connection', vars_wk['LogFile']) + _cmd = ['ping', '-n', '2', addr] + while True: + try: + run_program(_cmd) + break + except subprocess.CalledProcessError: + if not ask('ERROR: Can\'t ping {addr}, try again?'.format(addr=addr), vars_wk['LogFile']): + abort() + +def run_process_killer(): + """Kill most running processes skipping those in the whitelist.txt.""" + # borrowed from TronScript (reddit.com/r/TronScript) and credit to /u/cuddlychops06 + print_info('* Stopping all processes', vars_wk['LogFile']) + _prev_dir = os.getcwd() + extract_item('ProcessKiller', vars_wk, silent=True) + os.chdir('{BinDir}\\ProcessKiller'.format(**vars_wk)) + run_program(['ProcessKiller.exe', '/silent'], check=False) + os.chdir(_prev_dir) + +def run_autoruns(): + """Run AutoRuns in the background with VirusTotal checks enabled.""" + extract_item('SysinternalsSuite', vars_wk, filter='autoruns*', silent=True) + winreg.CreateKey(winreg.HKEY_CURRENT_USER, r'Software\Sysinternals\AutoRuns') + with winreg.OpenKey(winreg.HKEY_CURRENT_USER, r'Software\Sysinternals\AutoRuns', access=winreg.KEY_WRITE) as _key: + winreg.SetValueEx(_key, 'checkvirustotal', 0, winreg.REG_DWORD, 1) + winreg.SetValueEx(_key, 'EulaAccepted', 0, winreg.REG_DWORD, 1) + winreg.SetValueEx(_key, 'shownomicrosoft', 0, winreg.REG_DWORD, 1) + winreg.SetValueEx(_key, 'shownowindows', 0, winreg.REG_DWORD, 1) + winreg.SetValueEx(_key, 'showonlyvirustotal', 0, winreg.REG_DWORD, 1) + winreg.SetValueEx(_key, 'submitvirustotal', 0, winreg.REG_DWORD, 0) + winreg.SetValueEx(_key, 'verifysignatures', 0, winreg.REG_DWORD, 1) + winreg.CreateKey(winreg.HKEY_CURRENT_USER, r'Software\Sysinternals\AutoRuns\SigCheck') + with winreg.OpenKey(winreg.HKEY_CURRENT_USER, r'Software\Sysinternals\AutoRuns\SigCheck', access=winreg.KEY_WRITE) as _key: + winreg.SetValueEx(_key, 'EulaAccepted', 0, winreg.REG_DWORD, 1) + winreg.CreateKey(winreg.HKEY_CURRENT_USER, r'Software\Sysinternals\AutoRuns\Streams') + with winreg.OpenKey(winreg.HKEY_CURRENT_USER, r'Software\Sysinternals\AutoRuns\Streams', access=winreg.KEY_WRITE) as _key: + winreg.SetValueEx(_key, 'EulaAccepted', 0, winreg.REG_DWORD, 1) + winreg.CreateKey(winreg.HKEY_CURRENT_USER, r'Software\Sysinternals\AutoRuns\VirusTotal') + with winreg.OpenKey(winreg.HKEY_CURRENT_USER, r'Software\Sysinternals\AutoRuns\VirusTotal', access=winreg.KEY_WRITE) as _key: + winreg.SetValueEx(_key, 'VirusTotalTermsAccepted', 0, winreg.REG_DWORD, 1) + # Set autoruns to start minimized + info = subprocess.STARTUPINFO() + info.dwFlags = subprocess.STARTF_USESHOWWINDOW + info.wShowWindow = 6 + subprocess.Popen(vars_wk['AutoRuns'], startupinfo=info) + +def run_bleachbit(): + if not os.path.exists('{LogDir}\\BleachBit.log'.format(**vars_wk)): + print_info('* Checking for temp files', vars_wk['LogFile']) + extract_item('BleachBit', vars_wk, silent=True) + _args = ['--preview', '--preset'] + _out = run_program(vars_wk['BleachBit'], _args, check=False) + # Save stderr + if len(_out.stderr.decode().splitlines()) > 0: + with open('{LogDir}\\BleachBit.err'.format(**vars_wk), 'a') as f: + for line in _out.stderr.decode().splitlines(): + f.write(line.strip() + '\n') + # Save stdout + with open('{LogDir}\\BleachBit.log'.format(**vars_wk), 'a') as f: + for line in _out.stdout.decode().splitlines(): + f.write(line.strip() + '\n') + + # Temp file size + with open('{LogDir}\\BleachBit.log'.format(**vars_wk), 'r') as f: + for line in f.readlines(): + if re.search(r'^(disk space.*recovered|files.*deleted)', line, re.IGNORECASE): + print_standard(' ' + line.strip()) + +def run_chkdsk(): + """Run CHKDSK in a "split window" and report errors.""" + print_info('* Checking filesystem health', vars_wk['LogFile']) + _cmd = [ + 'chkdsk', + '{SYSTEMDRIVE}'.format(**vars_wk['Env'])] + _out = run_program(_cmd, check=False) + if int(_out.returncode) > 1: + # retcode == 0: no issues + # retcode == 1: fixed issues + # retcode == 2: issues + print_error(' ERROR: CHKDSK encountered errors', vars_wk['LogFile']) + + # Save stderr + with open('{LogDir}\\CHKDSK.err'.format(**vars_wk), 'a') as f: + for line in _out.stderr.decode().splitlines(): + f.write(line.strip() + '\n') + # Save stdout + with open('{LogDir}\\CHKDSK.log'.format(**vars_wk), 'a') as f: + for line in _out.stdout.decode().splitlines(): + f.write(line.strip() + '\n') + +def run_dism_health_check(): + """Run DISM /ScanHealth, then /CheckHealth, and then report errors.""" + if vars_wk['Version'] in ['8', '10']: + print_info('* Checking system image health', vars_wk['LogFile']) + # Scan Health + _args = [ + '/Online', + '/Cleanup-Image', + '/ScanHealth', + '/LogPath:{LogDir}\\DISM_ScanHealth.log'.format(**vars_wk), + '-new_console:n', + '-new_console:s33V'] + run_program('dism', _args, pipe=False, check=False) + wait_for_process('dism') + # Now check health + _args = [ + '/Online', + '/Cleanup-Image', + '/CheckHealth', + '/LogPath:{LogDir}\\DISM_CheckHealth.log'.format(**vars_wk)] + try: + _result = run_program('dism', _args).stdout.decode() + except subprocess.CalledProcessError: + print_error(' ERROR: failed to run DISM health check', vars_wk['LogFile']) + _result = ['Unknown'] + else: + # Check result + if not re.search(r'No component store corruption detected', _result, re.IGNORECASE): + for line in _result: + line = ' ' + line + print_warning(line, vars_wk['LogFile']) + print_error(' ERROR: DISM encountered errors, please review details above', vars_wk['LogFile']) + +def run_hitmanpro(): + """Run HitmanPro in the background.""" + print_info('* Running malware/virus scan (in the background)', vars_wk['LogFile']) + extract_item('HitmanPro', vars_wk, silent=True) + _cmd = [ + vars_wk['HitmanPro'], + '/quiet', + '/noinstall', + '/noupload', + '/log={LogDir}\\hitman.xml'.format(**vars_wk)] + subprocess.Popen(_cmd) + +def run_produkey(): + extract_item('ProduKey', vars_wk, silent=True) + if not os.path.exists('{LogDir}\\Product Keys (ProduKey).txt'.format(**vars_wk)): + print_info('* Saving product keys (secondary method)', vars_wk['LogFile']) + # Clear current configuration + for config in ['ProduKey.cfg', 'ProduKey64.cfg']: + try: + if os.path.exists('{BinDir}\\ProduKey\\{config}'.format(config=config, **vars_wk)): + os.remove('{BinDir}\\ProduKey\\{config}'.format(config=config, **vars_wk)) + except: + pass + _args = ['/nosavereg', '/stext', '{LogDir}\\Product Keys (ProduKey).txt'.format(**vars_wk)] + run_program(vars_wk['ProduKey'], _args, check=False) + +def run_rkill(): + """Run RKill and cleanup afterwards.""" + print_info('* Running RKill', vars_wk['LogFile']) + extract_item('RKill', vars_wk, silent=True) + _cmd = [ + '{BinDir}\\RKill\\RKill.exe'.format(**vars_wk), + '-l', + '{LogDir}\\RKill.log'.format(**vars_wk), + '-new_console:n', + '-new_console:s33V'] + run_program(_cmd, check=False) + wait_for_process('RKill') + kill_process('notepad.exe') + if not ask(' Did RKill run correctly?', vars_wk['LogFile']): + print_warning(' Opening folder for manual execution.', vars_wk['LogFile']) + try: + subprocess.Popen(['explorer.exe', '{BinDir}\\RKill'.format(**vars_wk)]) + except: + pass + if not ask(' Resume script?'): + abort() + + # RKill cleanup + for item in os.scandir('{USERPROFILE}\\Desktop'.format(**vars_wk['Env'])): + if re.search(r'^RKill', item.name, re.IGNORECASE): + shutil.move(item.path, '{ClientDir}\\Info\\{name}'.format(name=item.name, **vars_wk)) + +def run_siv(): + extract_item('SIV', vars_wk, silent=True) + # All system info + if not os.path.exists('{LogDir}\\System Information (SIV).txt'.format(**vars_wk)): + print_info('* Saving System information', vars_wk['LogFile']) + _cmd = [ + vars_wk['SIV'], + '-KEYS', + '-LOCAL', + '-UNICODE', + '-SAVE={LogDir}\\System_Information_(SIV).txt'.format(**vars_wk)] + run_program(_cmd, check=False) + + # RAM + if not os.path.exists('{LogDir}\\RAM_Information_(SIV).txt'.format(**vars_wk)): + _args = [ + '-KEYS', + '-LOCAL', + '-UNICODE', + '-SAVE=[dimms]={LogDir}\\RAM_Information_(SIV).txt'.format(**vars_wk)] + run_program(vars_wk['SIV'], _args, check=False) + + # Installed Programs + if not os.path.exists('{LogDir}\\Installed Program List_(SIV).txt'.format(**vars_wk)): + print_info('* Saving installed program list', vars_wk['LogFile']) + _args = [ + '-KEYS', + '-LOCAL', + '-UNICODE', + '-SAVE=[software]={LogDir}\\Installed_Program_List_(SIV).txt'.format(**vars_wk)] + run_program(vars_wk['SIV'], _args, check=False) + + # Product Keys + if not os.path.exists('{LogDir}\\Product Keys (SIV).txt'.format(**vars_wk)): + print_info('* Saving product keys', vars_wk['LogFile']) + _args = [ + '-KEYS', + '-LOCAL', + '-UNICODE', + '-SAVE=[product-ids]={LogDir}\\Product_Keys_(SIV).txt'.format(**vars_wk)] + run_program(vars_wk['SIV'], _args, check=False) + extract_item('ProduKey', vars_wk, silent=True) + + # Rename files + for item in os.scandir(vars_wk['LogDir']): + if re.search(r'SIV', item.name, re.IGNORECASE): + shutil.move(item.path, item.path.replace('_', ' ').title().replace('Siv', 'SIV')) + +def run_sfc_scan(): + """Run SFC in a "split window" and report errors.""" + print_info('* Checking system file health', vars_wk['LogFile']) + _cmd = [ + '{SYSTEMROOT}\\System32\\sfc.exe'.format(**vars_wk['Env']), + '/scannow'] + _out = run_program(_cmd, check=False) + # Save stderr + with open('{LogDir}\\SFC.err'.format(**vars_wk), 'a') as f: + for line in _out.stderr.decode().splitlines(): + f.write(line.strip() + '\n') + # Save stdout + with open('{LogDir}\\SFC.log'.format(**vars_wk), 'a') as f: + for line in _out.stdout.decode().splitlines(): + f.write(line.strip() + '\n') + +def run_tdsskiller(): + """Run TDSSKiller.""" + print_info('* Running rootkit scan', vars_wk['LogFile']) + extract_item('TDSSKiller', vars_wk, silent=True) + os.makedirs('{ClientDir}\\Quarantine\\TDSSKiller'.format(**vars_wk), exist_ok=True) + _cmd = '{BinDir}\\TDSSKiller\\TDSSKiller.exe'.format(**vars_wk) + _args = [ + '-l', + '{LogDir}\\TDSSKiller.log'.format(**vars_wk), + '-qpath', + '{ClientDir}\\Quarantine\\TDSSKiller'.format(**vars_wk), + '-accepteula', + '-accepteulaksn', + '-dcexact', + '-tdlfs'] + try: + run_program(_cmd, _args, pipe=False) + except subprocess.CalledProcessError: + print_error('ERROR: Failed to run TDSSKiller.', vars_wk['LogFile']) + abort() + +def upload_info(): + print_info('* Uploading info to NAS', vars_wk['LogFile']) + path = '{ClientDir}'.format(**vars_wk) + file = 'Info_{Date-Time}.7z'.format(**vars_wk) + + # Compress Info + _cmd = [ + vars_wk['SevenZip'], + 'a', '-t7z', '-mx=9', '-bso0', '-bse0', + '{path}\\{file}'.format(path=path, file=file), + '{ClientDir}\\Info'.format(**vars_wk)] + try: + run_program(_cmd, pipe=False) + except subprocess.CalledProcessError: + print_error(' ERROR: Failed to compress data for upload.', vars_wk['LogFile']) + return + + # Upload Info + try: + upload_data(path, file, vars_wk) + except: + print_error(' ERROR: Failed to upload info.', vars_wk['LogFile']) + +if __name__ == '__main__': + stay_awake(vars_wk) + get_ticket_number() + os.system('cls') + print_info('Starting Software Diagnostics for Ticket #{TicketNumber}\n'.format(**vars_wk), vars_wk['LogFile']) + + # Sanitize Environment + run_process_killer() + run_rkill() + run_tdsskiller() + + # Re-run if earlier process was stopped. + stay_awake(vars_wk) + + # Network Check + ping_test() + + # Start background scans + run_hitmanpro() + run_autoruns() + + # OS Health Checks + run_chkdsk() + run_sfc_scan() + run_dism_health_check() + + # Export system info + backup_file_list() + backup_power_plans() + backup_registry() + backup_browsers() + run_siv() + run_produkey() + + # Summary + run_bleachbit() + get_free_space() + get_installed_ram() + get_installed_office() + get_product_keys() + get_os_info() + get_battery_info() + get_user_data_summary() + + # Upload info + upload_info() + + # Done + print_standard('\nDone.', vars_wk['LogFile']) + pause('Press Enter to exit...') + + # Open log + extract_item('Notepad2', vars_wk, silent=True) + subprocess.Popen([vars_wk['Notepad2'], vars_wk['LogFile']]) + + # Quit + kill_process('caffeine.exe') + exit_script() \ No newline at end of file diff --git a/.bin/Scripts/transferred_keys.cmd b/.bin/Scripts/transferred_keys.cmd deleted file mode 100644 index ee1d419d..00000000 --- a/.bin/Scripts/transferred_keys.cmd +++ /dev/null @@ -1,101 +0,0 @@ -:: Wizard Kit: Scan all transferred software hive for product keys - -@echo off - -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - -:Init -setlocal EnableDelayedExpansion -color 1b -title Wizard Kit: Key Finder -rem Create %client_dir%\Info\YYYY-MM-DD and set path as %log_dir% -call "%bin%\Scripts\init_client_dir.cmd" /Info -set "transfer_dir=%client_dir%\Transfer" - -:ClearConfigs -if not exist "%bin%\tmp" goto Extract -pushd "%bin%\tmp" -if exist "ProduKey.cfg" del "ProduKey.cfg" -if exist "ProduKey64.cfg" del "ProduKey64.cfg" -popd - -:Extract -mkdir "%bin%\tmp" >nul 2>&1 -"%bin%\7-Zip\7za.exe" e "%bin%\ProduKey.7z" -o"%bin%\tmp" -aoa -pAbracadabra -bsp0 -bso0 -ping -n 2 127.0.0.1>nul -set "prog=%bin%\tmp\ProduKey.exe" -if /i "!PROCESSOR_ARCHITECTURE!" == "AMD64" ( - if exist "!prog:.=64.!" set "prog=!prog:.=64.!" -) - -:FindHives -cls -echo Scanning for transferred software hive(s)... -call :ScanHive "%transfer_dir%\Software" -call :ScanHive "%transfer_dir%\config\Software" -call :ScanHive "%transfer_dir%\config\RegBack\Software" -call :ScanHive "%transfer_dir%\Windows\System32\config\Software" -call :ScanHive "%transfer_dir%\Windows\System32\config\RegBack\Software" -call :ScanHive "%transfer_dir%\Windows.old\Software" -call :ScanHive "%transfer_dir%\Windows.old\config\Software" -call :ScanHive "%transfer_dir%\Windows.old\config\RegBack\Software" -call :ScanHive "%transfer_dir%\Windows.old\Windows\System32\config\Software" -call :ScanHive "%transfer_dir%\Windows.old\Windows\System32\config\RegBack\Software" -call :ScanHive "%transfer_dir%\Win.old\Software" -call :ScanHive "%transfer_dir%\Win.old\config\Software" -call :ScanHive "%transfer_dir%\Win.old\config\RegBack\Software" -call :ScanHive "%transfer_dir%\Win.old\Windows\System32\config\Software" -call :ScanHive "%transfer_dir%\Win.old\Windows\System32\config\RegBack\Software" - -:ShowResults -if not exist "%log_dir%\transferred_keys.txt" (goto NoResults) -call "%bin%\Scripts\Launch.cmd" Program "%bin%\Notepad2" "Notepad2-Mod.exe" "%log_dir%\transferred_keys.txt" -goto Done - -:ScanHive -if exist "%~1" ( - echo. %~1 - echo ==== %~1 ====>> "%log_dir%\transferred_keys.txt" - "%prog%" /IEKeys 0 /WindowsKeys 1 /OfficeKeys 1 /ExtractEdition 1 /nosavereg /regfile "%~1" /stext "" >> %log_dir%\transferred_keys.txt -) -goto :EOF - -:NoResults -echo. -echo No keys found. -goto Error - -:ErrorNoBin -popd -echo ".bin" folder not found, aborting script. -echo. -goto Error - -:Error -color 4e -echo. -echo Press any key to exit... -pause>nul -goto Exit - -:Done -goto Exit - -:Exit -popd -color -endlocal - -:EOF diff --git a/.bin/Scripts/transferred_keys.py b/.bin/Scripts/transferred_keys.py new file mode 100644 index 00000000..ea6d86b9 --- /dev/null +++ b/.bin/Scripts/transferred_keys.py @@ -0,0 +1,105 @@ +# Wizard Kit: Transferred Keys + +import os +import re +import subprocess + +# Init +os.chdir(os.path.dirname(os.path.realpath(__file__))) +os.system('title Wizard Kit: Key Tool') +from functions import * +vars_wk = init_vars_wk() +vars_wk.update(init_vars_os()) +vars_wk['LogFile'] = '{LogDir}\\Transferred Keys.log'.format(**vars_wk) +vars_wk['Notepad2'] = '{BinDir}\\Notepad2\\Notepad2-Mod.exe'.format(**vars_wk) +vars_wk['ProduKey'] = '{BinDir}\\ProduKey\\ProduKey.exe'.format(**vars_wk) +if vars_wk['Arch'] == 64: + vars_wk['Notepad2'] = vars_wk['Notepad2'].replace('.exe', '64.exe') + vars_wk['ProduKey'] = vars_wk['ProduKey'].replace('.exe', '64.exe') +os.makedirs(vars_wk['LogDir'], exist_ok=True) +REGEX_DIR = re.compile(r'^(config$|RegBack$|System32$|Transfer|Win)', re.IGNORECASE) +REGEX_FILE = re.compile(r'^Software$', re.IGNORECASE) + +def abort(): + print_warning('Aborted.', vars_wk['LogFile']) + exit_script() + +def exit_script(): + pause("Press Enter to exit...") + quit() + +def find_hives(): + """Search for transferred SW hives and return a list.""" + hives = [] + search_paths = [vars_wk['ClientDir']] + + while len(search_paths) > 0: + for item in os.scandir(search_paths.pop(0)): + if item.is_dir() and REGEX_DIR.search(item.name): + search_paths.append(item.path) + if item.is_file() and REGEX_FILE.search(item.name): + hives.append(item.path) + + return hives + +def extract_keys(hives=None): + """Extract keys from provided hives and return a dict.""" + keys = {} + + # Bail early + if hives is None: + print_error(' ERROR: No hives found.') + abort() + + # Extract keys + extract_item('ProduKey', vars_wk) + for hive in hives: + print_standard(' Scanning {hive}...'.format(hive=hive), vars_wk['LogFile']) + _args = [ + '/IEKeys', '0', + '/WindowsKeys', '1', + '/OfficeKeys', '1', + '/ExtractEdition', '1', + '/nosavereg', + '/regfile', hive, + '/scomma', ''] + try: + _out = run_program(vars_wk['ProduKey'], _args) + for line in _out.stdout.decode().splitlines(): + # Add key to keys under product only if unique + _tmp = line.split(',') + _product = _tmp[0] + _key = _tmp[2] + if _product not in keys: + keys[_product] = [] + if _key not in keys[_product]: + keys[_product].append(_key) + except subprocess.CalledProcessError: + print_error(' Failed to extract any keys', vars_wk['LogFile']) + else: + for line in _out.stdout.decode().splitlines(): + _match = re.search(r'', line, re.IGNORECASE) + + return keys + +if __name__ == '__main__': + stay_awake(vars_wk) + hives = find_hives() + keys = extract_keys(hives) + + # Save Keys + if keys: + for product in sorted(keys): + print_standard('{product}:'.format(product=product), vars_wk['LogFile']) + for key in sorted(keys[product]): + print_standard(' {key}'.format(key=key), vars_wk['LogFile']) + else: + print_error('No keys found.', vars_wk['LogFile']) + + # Open log + extract_item('Notepad2', vars_wk, silent=True) + subprocess.Popen([vars_wk['Notepad2'], vars_wk['LogFile']]) + + # Quit + kill_process('caffeine.exe') + exit_script() \ No newline at end of file diff --git a/.bin/Scripts/update_kit.ps1 b/.bin/Scripts/update_kit.ps1 deleted file mode 100644 index f4f57736..00000000 --- a/.bin/Scripts/update_kit.ps1 +++ /dev/null @@ -1,312 +0,0 @@ -# Wizard Kit: Download the latest versions of the programs in the kit - -## Init ## -$wd = $(Split-Path $MyInvocation.MyCommand.Path) -pushd "$wd" -. .\init.ps1 -clear -$host.UI.RawUI.WindowTitle = "Wizard Kit: Kit Update Tool" -$bin = (Get-Item $wd).Parent.FullName -$curl = "$bin\curl\curl.exe" -$sz = "$bin\7-Zip\7za.exe" - -# OS Check -. .\check_os.ps1 -if ($arch -eq 64) { - $sz = "$bin\7-Zip\7za64.exe" -} - -## Functions ## -function download-file { - param ([String]$path, [String]$name, [String]$url) - $output = "{0}\{1}" -f $path, $name - - write-host ("Downloading {0}" -f $name) - New-Item -Type Directory $path 2>&1 | Out-Null - start "$curl" -argumentlist @("-#LSfo", "`"$output`"", "`"$url`"") -nonewwindow -wait -} -function find-dynamic-url { - param ([String]$source_page, [String]$regex) - $d_url = "" - - # Get source page - start "$curl" -argumentlist @("-Lfso", "tmp_page", "`"$source_page`"") -nonewwindow -wait - - # Search for real url - $d_url = Get-Content "tmp_page" | Where-Object {$_ -imatch $regex} - $d_url = $d_url -ireplace '.*(a |)href="([^"]+)".*', '$2' - $d_url = $d_url -ireplace ".*(a |)href='([^']+)'.*", '$2' - - # Remove tmp_page - Remove-Item "tmp_page" - - return $d_url -} - -## Diagnostics ## -# HitmanPro -$path = "$bin\HitmanPro" -$name = "HitmanPro.exe" -$url = "http://dl.surfright.nl/HitmanPro.exe" -download-file $path $name $url -$name = "HitmanPro64.exe" -$url = "http://dl.surfright.nl/HitmanPro_x64.exe" -download-file $path $name $url - -## VR-OSR ## -# AdwCleaner -$path = "$bin" -$name = "AdwCleaner.exe" -$dl_page = "http://www.bleepingcomputer.com/download/adwcleaner/dl/125/" -$regex = "href=.*http(s|)://download\.bleepingcomputer\.com/dl/[a-zA-Z0-9]+/[a-zA-Z0-9]+/windows/security/security-utilities/a/adwcleaner/AdwCleaner\.exe" -$url = find-dynamic-url $dl_page $regex -download-file $path $name $url - -# ESET Online Scanner -$path = "$bin" -$name = "ESET.exe" -$url = "http://download.eset.com/special/eos/esetsmartinstaller_enu.exe" -download-file $path $name $url - -# Junkware Removal Tool -$path = "$bin" -$name = "JRT.exe" -$url = "http://downloads.malwarebytes.org/file/jrt" -download-file $path $name $url - -# Kaspersky Virus Removal Tool -$path = "$bin" -$name = "KVRT.exe" -$url = "http://devbuilds.kaspersky-labs.com/devbuilds/KVRT/latest/full/KVRT.exe" -download-file $path $name $url - -# RKill -$path = "$bin\RKill" -$name = "RKill.exe" -$dl_page = "http://www.bleepingcomputer.com/download/rkill/dl/10/" -$regex = "href=.*http(s|)://download\.bleepingcomputer\.com/dl/[a-zA-Z0-9]+/[a-zA-Z0-9]+/windows/security/security-utilities/r/rkill/rkill\.exe" -$url = find-dynamic-url $dl_page $regex -download-file $path $name $url - -# TDSSKiller -$path = "$bin" -$name = "TDSSKiller.exe" -$url = "http://media.kaspersky.com/utilities/VirusUtilities/EN/tdsskiller.exe" -download-file $path $name $url - -## Driver Tools ## -# Acer Serial Number Detect Tool -$path = "$bin\_Drivers" -$name = "Acer Serial Number Detect Tool.exe" -$url = "http://global-download.acer.com/SupportFiles/Files/SNID/APP/SerialNumberDetectionTool.exe" -download-file $path $name $url - -# AMD Autodetect -$path = "$bin\_Drivers" -$name = "AMD Autodetect.exe" -$url = "http://www2.ati.com/drivers/auto/autodetectutility.exe" -download-file $path $name $url - -# AMD Gaming Evolved -$path = "$bin\_Drivers" -$name = "AMD Gaming Evolved.exe" -$url = "http://clientupdater.raptr.com/client/pc/amd/raptr_installer.exe" -download-file $path $name $url - -# Dell System Detect -$path = "$bin\_Drivers" -$name = "Dell System Detect.exe" -$url = "https://downloads.dell.com/tools/dellsystemdetect/dellsystemdetectlauncher.exe" -download-file $path $name $url - -# GeForce Experience -$path = "$bin\_Drivers" -$name = "GeForce Experience.exe" -$dl_page = "http://www.geforce.com/geforce-experience/download" -$regex = "href=.*http(s|)://us\.download\.nvidia\.com/GFE/GFEClient/[0-9\.]+/GeForce_Experience_v[0-9\.]+\.exe" -$url = find-dynamic-url $dl_page $regex -download-file $path $name $url - -# HP Support Solutions Framework -$path = "$bin\_Drivers" -$name = "HP Support Solutions Framework.exe" -$url = "http://h20614.www2.hp.com/ediags/filehosting/api/installer" -download-file $path $name $url - -# Intel Driver Update Utility -$path = "$bin\_Drivers" -$name = "Intel Driver Update Utility.exe" -$dl_page = "http://www.intel.com/content/www/us/en/support/detect.html" -$regex = "a href.*http(s|)://downloadmirror\.intel\.com/[a-zA-Z0-9]+/[a-zA-Z0-9]+/Intel%20Driver%20Update%20Utility%20Installer.exe" -$url = find-dynamic-url $dl_page $regex -$url = find-dynamic-url $dl_page $regex -download-file $path $name $url - -# Intel SSD Toolbox -$path = "$bin\_Drivers" -$name = "Intel SSD Toolbox.exe" -$dl_page = "https://downloadcenter.intel.com/download/26085/Intel-Solid-State-Drive-Toolbox" -$regex = "href=./downloads/eula/[0-9]+/Intel-Solid-State-Drive-Toolbox.httpDown=https\%3A\%2F\%2Fdownloadmirror\.intel\.com\%2F[0-9]+\%2Feng\%2FIntel\%20SSD\%20Toolbox\%20-\%20v[0-9\.]+.exe" -$url = find-dynamic-url $dl_page $regex -$url = $url -ireplace '.*httpDown=(.*)', '$1' -$url = $url -ireplace '%3A', ':' -$url = $url -ireplace '%2F', '/' -download-file $path $name $url - -# Lenovo Service Bridge -$path = "$bin\_Drivers" -$name = "Lenovo Service Bridge.exe" -$url = "https://download.lenovo.com/lsb/LSBsetup.exe" -download-file $path $name $url - -# Samsung Magician -$path = "$bin\_Drivers" -$name = "Samsung Magician.zip" -$dl_page = "http://www.samsung.com/semiconductor/minisite/ssd/download/tools.html" -$regex = "href=./semiconductor/minisite/ssd/downloads/software/Samsung_Magician_Setup_v[0-9]+.zip" -$url = "http://www.samsung.com{0}" -f (find-dynamic-url $dl_page $regex) -download-file $path $name $url -start $sz -argumentlist @("e", "`"$bin\_Drivers\Samsung Magician.zip`"", "-aoa", "-bso0", "-bsp0", "-o$bin\_Drivers") -nonewwindow -wait -Remove-Item "$bin\_Drivers\Samsung Magician.exe" $path 2>&1 | Out-Null -Remove-Item "$bin\_Drivers\Samsung Magician.zip" $path 2>&1 | Out-Null -Move-Item "$bin\_Drivers\Samsung*exe" "$bin\_Drivers\Samsung Magician.exe" $path 2>&1 | Out-Null - -# SanDisk Express Cache -$path = "$bin\_Drivers" -$name = "SanDisk Express Cache.exe" -$url = "http://mp3support.sandisk.com/ReadyCache/ExpressCacheSetup.exe" -download-file $path $name $url - -# Toshiba System Detect -$path = "$bin\_Drivers" -$name = "Toshiba System Detect.exe" -$url = "http://cdgenp01.csd.toshiba.com/content/support/downloads/GetProductInfo.exe" -download-file $path $name $url - -## Installers ## -$path = (Get-Item $wd).Parent.Parent.FullName -$path = "$path\Installers" - -# Ninite - Main -download-file "$path" "MSE.exe" "https://ninite.com/essentials/ninite.exe" -download-file "$path" "Runtimes.exe" "https://ninite.com/.net4.6.2-air-java8-silverlight/ninite.exe" -download-file "$path" "Win7.exe" "https://ninite.com/.net4.6.2-7zip-air-chrome-firefox-java8-silverlight-vlc/ninite.exe" -download-file "$path" "Win8.exe" "https://ninite.com/.net4.6.2-7zip-air-chrome-classicstart-firefox-java8-silverlight-vlc/ninite.exe" -download-file "$path" "Win10.exe" "https://ninite.com/.net4.6.2-7zip-air-chrome-classicstart-firefox-java8-silverlight-vlc/ninite.exe" - -# Ninite - Audio-Video -download-file "$path\Extras\Audio-Video" "AIMP.exe" "https://ninite.com/aimp/ninite.exe" -download-file "$path\Extras\Audio-Video" "Audacity.exe" "https://ninite.com/audacity/ninite.exe" -download-file "$path\Extras\Audio-Video" "CCCP.exe" "https://ninite.com/cccp/ninite.exe" -download-file "$path\Extras\Audio-Video" "Foobar2000.exe" "https://ninite.com/foobar/ninite.exe" -download-file "$path\Extras\Audio-Video" "GOM.exe" "https://ninite.com/gom/ninite.exe" -download-file "$path\Extras\Audio-Video" "iTunes.exe" "https://ninite.com/itunes/ninite.exe" -download-file "$path\Extras\Audio-Video" "K-Lite Codecs.exe" "https://ninite.com/klitecodecs/ninite.exe" -download-file "$path\Extras\Audio-Video" "KMPlayer.exe" "https://ninite.com/kmplayer/ninite.exe" -download-file "$path\Extras\Audio-Video" "MediaMonkey.exe" "https://ninite.com/mediamonkey/ninite.exe" -download-file "$path\Extras\Audio-Video" "MusicBee.exe" "https://ninite.com/musicbee/ninite.exe" -download-file "$path\Extras\Audio-Video" "Spotify.exe" "https://ninite.com/spotify/ninite.exe" -download-file "$path\Extras\Audio-Video" "VLC.exe" "https://ninite.com/vlc/ninite.exe" -download-file "$path\Extras\Audio-Video" "Winamp.exe" "https://ninite.com/winamp/ninite.exe" - -# Ninite - Cloud Storage -download-file "$path\Extras\Cloud Storage" "BitTorrent Sync.exe" "https://ninite.com/bittorrentsync/ninite.exe" -download-file "$path\Extras\Cloud Storage" "Dropbox.exe" "https://ninite.com/dropbox/ninite.exe" -download-file "$path\Extras\Cloud Storage" "Google Drive.exe" "https://ninite.com/googledrive/ninite.exe" -download-file "$path\Extras\Cloud Storage" "Mozy.exe" "https://ninite.com/mozy/ninite.exe" -download-file "$path\Extras\Cloud Storage" "OneDrive.exe" "https://ninite.com/onedrive/ninite.exe" -download-file "$path\Extras\Cloud Storage" "SugarSync.exe" "https://ninite.com/sugarsync/ninite.exe" - -# Ninite - Communication -download-file "$path\Extras\Communication" "AIM.exe" "https://ninite.com/aim/ninite.exe" -download-file "$path\Extras\Communication" "Pidgin.exe" "https://ninite.com/pidgin/ninite.exe" -download-file "$path\Extras\Communication" "Skype.exe" "https://ninite.com/skype/ninite.exe" -download-file "$path\Extras\Communication" "Trillian.exe" "https://ninite.com/trillian/ninite.exe" - -# Ninite - Compression -download-file "$path\Extras\Compression" "7-Zip.exe" "https://ninite.com/7zip/ninite.exe" -download-file "$path\Extras\Compression" "PeaZip.exe" "https://ninite.com/peazip/ninite.exe" -download-file "$path\Extras\Compression" "WinRAR.exe" "https://ninite.com/winrar/ninite.exe" - -# Ninite - Developer -download-file "$path\Extras\Developer" "Eclipse.exe" "https://ninite.com/eclipse/ninite.exe" -download-file "$path\Extras\Developer" "FileZilla.exe" "https://ninite.com/filezilla/ninite.exe" -download-file "$path\Extras\Developer" "JDK 8.exe" "https://ninite.com/jdk8/ninite.exe" -download-file "$path\Extras\Developer" "JDK 8 (x64).exe" "https://ninite.com/jdkx8/ninite.exe" -download-file "$path\Extras\Developer" "Notepad++.exe" "https://ninite.com/notepadplusplus/ninite.exe" -download-file "$path\Extras\Developer" "PuTTY.exe" "https://ninite.com/putty/ninite.exe" -download-file "$path\Extras\Developer" "Python 2.exe" "https://ninite.com/python/ninite.exe" -download-file "$path\Extras\Developer" "Visual Studio Code.exe" "https://ninite.com/vscode/ninite.exe" -download-file "$path\Extras\Developer" "WinMerge.exe" "https://ninite.com/winmerge/ninite.exe" -download-file "$path\Extras\Developer" "WinSCP.exe" "https://ninite.com/winscp/ninite.exe" - -# Ninite - File Sharing -download-file "$path\Extras\File Sharing" "eMule.exe" "https://ninite.com/emule/ninite.exe" -download-file "$path\Extras\File Sharing" "qBittorrent.exe" "https://ninite.com/qbittorrent/ninite.exe" - -# Ninite - Image-Photo -download-file "$path\Extras\Image-Photo" "FastStone.exe" "https://ninite.com/faststone/ninite.exe" -download-file "$path\Extras\Image-Photo" "GIMP.exe" "https://ninite.com/gimp/ninite.exe" -download-file "$path\Extras\Image-Photo" "Greenshot.exe" "https://ninite.com/greenshot/ninite.exe" -download-file "$path\Extras\Image-Photo" "Inkscape.exe" "https://ninite.com/inkscape/ninite.exe" -download-file "$path\Extras\Image-Photo" "IrfanView.exe" "https://ninite.com/irfanview/ninite.exe" -download-file "$path\Extras\Image-Photo" "Paint.NET.exe" "https://ninite.com/paint.net/ninite.exe" -download-file "$path\Extras\Image-Photo" "ShareX.exe" "https://ninite.com/sharex/ninite.exe" -download-file "$path\Extras\Image-Photo" "XnView.exe" "https://ninite.com/xnview/ninite.exe" - -# Ninite - Misc -download-file "$path\Extras\Misc" "Classic Start.exe" "https://ninite.com/classicstart/ninite.exe" -download-file "$path\Extras\Misc" "Evernote.exe" "https://ninite.com/evernote/ninite.exe" -download-file "$path\Extras\Misc" "Everything.exe" "https://ninite.com/everything/ninite.exe" -download-file "$path\Extras\Misc" "Google Earth.exe" "https://ninite.com/googleearth/ninite.exe" -download-file "$path\Extras\Misc" "NV Access.exe" "https://ninite.com/nvda/ninite.exe" -download-file "$path\Extras\Misc" "Steam.exe" "https://ninite.com/steam/ninite.exe" - -# Ninite - Office -download-file "$path\Extras\Office" "CutePDF.exe" "https://ninite.com/cutepdf/ninite.exe" -download-file "$path\Extras\Office" "Foxit Reader.exe" "https://ninite.com/foxit/ninite.exe" -download-file "$path\Extras\Office" "LibreOffice.exe" "https://ninite.com/libreoffice/ninite.exe" -download-file "$path\Extras\Office" "OpenOffice.exe" "https://ninite.com/openoffice/ninite.exe" -download-file "$path\Extras\Office" "PDFCreator.exe" "https://ninite.com/pdfcreator/ninite.exe" -download-file "$path\Extras\Office" "SumatraPDF.exe" "https://ninite.com/sumatrapdf/ninite.exe" -download-file "$path\Extras\Office" "Thunderbird.exe" "https://ninite.com/thunderbird/ninite.exe" - -# Ninite - Runtimes -download-file "$path\Extras\Runtimes" "dotNET.exe" "https://ninite.com/.net4.6.2/ninite.exe" -download-file "$path\Extras\Runtimes" "Adobe Air.exe" "https://ninite.com/air/ninite.exe" -download-file "$path\Extras\Runtimes" "Java 8.exe" "https://ninite.com/java8/ninite.exe" -download-file "$path\Extras\Runtimes" "Shockwave.exe" "https://ninite.com/shockwave/ninite.exe" -download-file "$path\Extras\Runtimes" "Silverlight.exe" "https://ninite.com/silverlight/ninite.exe" - -# Ninite - Security -download-file "$path\Extras\Security" "Ad-Aware.exe" "https://ninite.com/adaware/ninite.exe" -download-file "$path\Extras\Security" "Avast.exe" "https://ninite.com/avast/ninite.exe" -download-file "$path\Extras\Security" "AVG.exe" "https://ninite.com/avg/ninite.exe" -download-file "$path\Extras\Security" "Avira.exe" "https://ninite.com/avira/ninite.exe" -download-file "$path\Extras\Security" "Microsoft Security Essentials.exe" "https://ninite.com/essentials/ninite.exe" -download-file "$path\Extras\Security" "Malwarebytes Anti-Malware.exe" "https://ninite.com/malwarebytes/ninite.exe" -download-file "$path\Extras\Security" "Spybot 2.exe" "https://ninite.com/spybot2/ninite.exe" -download-file "$path\Extras\Security" "SUPERAntiSpyware.exe" "https://ninite.com/super/ninite.exe" - -# Ninite - Utilities -download-file "$path\Extras\Utilities" "Auslogics DiskDefrag.exe" "https://ninite.com/auslogics/ninite.exe" -download-file "$path\Extras\Utilities" "CDBurnerXP.exe" "https://ninite.com/cdburnerxp/ninite.exe" -download-file "$path\Extras\Utilities" "Glary Utilities.exe" "https://ninite.com/glary/ninite.exe" -download-file "$path\Extras\Utilities" "ImgBurn.exe" "https://ninite.com/imgburn/ninite.exe" -download-file "$path\Extras\Utilities" "InfraRecorder.exe" "https://ninite.com/infrarecorder/ninite.exe" -download-file "$path\Extras\Utilities" "KeePass 2.exe" "https://ninite.com/keepass2/ninite.exe" -download-file "$path\Extras\Utilities" "Launchy.exe" "https://ninite.com/launchy/ninite.exe" -download-file "$path\Extras\Utilities" "RealVNC.exe" "https://ninite.com/realvnc/ninite.exe" -download-file "$path\Extras\Utilities" "Revo Uninstaller.exe" "https://ninite.com/revo/ninite.exe" -download-file "$path\Extras\Utilities" "TeamViewer 11.exe" "https://ninite.com/teamviewer11/ninite.exe" -download-file "$path\Extras\Utilities" "TeraCopy.exe" "https://ninite.com/teracopy/ninite.exe" -download-file "$path\Extras\Utilities" "WinDirStat.exe" "https://ninite.com/windirstat/ninite.exe" - -# Ninite - Web Browsers -download-file "$path\Extras\Web Browsers" "Google Chrome.exe" "https://ninite.com/chrome/ninite.exe" -download-file "$path\Extras\Web Browsers" "Firefox.exe" "https://ninite.com/firefox/ninite.exe" -download-file "$path\Extras\Web Browsers" "Opera.exe" "https://ninite.com/operaChromium/ninite.exe" - -## Done ## -popd -pause "Press Enter to exit..." diff --git a/.bin/Scripts/update_kit.py b/.bin/Scripts/update_kit.py index 3d99ee51..204281f9 100644 --- a/.bin/Scripts/update_kit.py +++ b/.bin/Scripts/update_kit.py @@ -34,116 +34,6 @@ def resolve_dynamic_url(source_url, regex): _tmp_file = '{TmpDir}/webpage.tmp'.format(**vars) _args = ['-#LSfo', _tmp_file, source_url] try: -<<<<<<< HEAD - run_program(cmd) - except subprocess.CalledProcessError: - errors = True - print_error('Failed to apply Windows image.') - - # Create boot files - if not errors: - print(' Creating boot files...'.format(**selected_windows_version)) - try: - run_program('bcdboot W:\\Windows /s S: /f ALL') - except subprocess.CalledProcessError: - errors = True - print_error('Failed to create boot files.') - if re.search(r'^(8|10)', selected_windows_version['Family']): - try: - run_program('W:\\Windows\\System32\\reagentc /setreimage /path T:\\Recovery\\WindowsRE /target W:\\Windows') - except subprocess.CalledProcessError: - # errors = True # Changed to warning. - print_warning('Failed to setup WindowsRE files.') - - # Print summary - if errors: - print_warning('\nErrors were encountered during setup.') - time.sleep(300) - else: - print_success('\nNo errors were encountered during setup.') - time.sleep(10) - pause('\nPress Enter to return to main menu... ') - -def menu_tools(): - tools = [ - {'Name': 'Blue Screen View', 'Folder': 'BlueScreenView', 'File': 'BlueScreenView.exe'}, - {'Name': 'CPU-Z', 'Folder': 'CPU-Z', 'File': 'cpuz.exe'}, - {'Name': 'Explorer++', 'Folder': 'Explorer++', 'File': 'Explorer++.exe'}, - {'Name': 'Fast Copy', 'Folder': 'FastCopy', 'File': 'FastCopy.exe', 'Args': ['/log', '/logfile=X:\WK\Info\FastCopy.log', '/cmd=noexist_only', '/utf8', '/skip_empty_dir', '/linkdest', '/open_window', '/balloon=FALSE', r'/exclude=$RECYCLE.BIN;$Recycle.Bin;.AppleDB;.AppleDesktop;.AppleDouble;.com.apple.timemachine.supported;.dbfseventsd;.DocumentRevisions-V100*;.DS_Store;.fseventsd;.PKInstallSandboxManager;.Spotlight*;.SymAV*;.symSchedScanLockxz;.TemporaryItems;.Trash*;.vol;.VolumeIcon.icns;desktop.ini;Desktop?DB;Desktop?DF;hiberfil.sys;lost+found;Network?Trash?Folder;pagefile.sys;Recycled;RECYCLER;System?Volume?Information;Temporary?Items;Thumbs.db']}, - {'Name': 'HWiNFO', 'Folder': 'HWiNFO', 'File': 'HWiNFO.exe'}, - {'Name': 'HW Monitor', 'Folder': 'HWMonitor', 'File': 'HWMonitor.exe'}, - {'Name': 'NT Password Editor', 'Folder': 'NT Password Editor', 'File': 'ntpwedit.exe'}, - {'Name': 'Notepad2', 'Folder': 'Notepad2', 'File': 'Notepad2-Mod.exe'}, - {'Name': 'PhotoRec', 'Folder': 'TestDisk', 'File': 'photorec_win.exe', 'Args': ['-new_console:n']}, - {'Name': 'Prime95', 'Folder': 'Prime95', 'File': 'prime95.exe'}, - {'Name': 'ProduKey', 'Folder': 'ProduKey', 'File': 'ProduKey.exe', 'Args': ['/external', '/ExtractEdition:1']}, - {'Name': 'Q-Dir', 'Folder': 'Q-Dir', 'File': 'Q-Dir.exe'}, - {'Name': 'TestDisk', 'Folder': 'TestDisk', 'File': 'testdisk_win.exe', 'Args': ['-new_console:n']}, - ] - actions = [ - {'Name': 'Main Menu', 'Letter': 'M'}, - ] - - # Menu loop - while True: - selection = menu_select('Tools Menu', tools, actions) - - if (selection.isnumeric()): - tool = tools[int(selection)-1] - cmd = ['{bin}\\{folder}\\{file}'.format(bin=bin, folder=tool['Folder'], file=tool['File'])] - if tool['Name'] == 'Blue Screen View': - # Select path to scan - minidump_path = select_minidump_path() - if minidump_path is not None: - tool['Args'] = ['/MiniDumpFolder', minidump_path] - if 'Args' in tool: - cmd += tool['Args'] - try: - subprocess.Popen(cmd) - except: - print_error('Failed to run {prog}'.format(prog=tool['Name'])) - time.sleep(2) - elif (selection == 'M'): - break - -def menu_main(): - menus = [ - {'Name': 'Create Backups', 'Menu': menu_backup_imaging}, - {'Name': 'Install Windows', 'Menu': menu_windows_setup}, - {'Name': 'Misc Tools', 'Menu': menu_tools}, - ] - actions = [ - {'Name': 'Command Prompt', 'Letter': 'C'}, - {'Name': 'Reboot', 'Letter': 'R'}, - {'Name': 'Shutdown', 'Letter': 'S'}, - ] - - # Main loop - while True: - selection = menu_select('Main Menu', menus, actions, secret_exit=True) - - if (selection.isnumeric()): - try: - menus[int(selection)-1]['Menu']() - except AbortException: - pass - except: - print_error('Major exception in: {menu}'.format(menu=menus[int(selection)-1]['Name'])) - print_warning(' Please let The Wizard know and he\'ll look into it (Please include the details below).') - print(traceback.print_exc()) - print_info(' You can reboot and try again but if this crashes again an alternative approach is required.') - time.sleep(300) - pause('Press Enter to shutdown...') - run_program(['wpeutil', 'shutdown']) - elif (selection == 'C'): - run_program(['cmd', '-new_console:n'], check=False) - elif (selection == 'R'): - run_program(['wpeutil', 'reboot']) - elif (selection == 'S'): - run_program(['wpeutil', 'shutdown']) - else: - quit() -======= os.makedirs(vars['TmpDir'], exist_ok=True) run_program(curl, _args) except: @@ -161,9 +51,9 @@ def menu_main(): # Cleanup and return os.remove(_tmp_file) return _url ->>>>>>> d9a6f8abf55c460cf0adeea19aded1786b3bc5d0 if __name__ == '__main__': + stay_awake(vars_wk) ## Diagnostics ## # HitmanPro _path = '{BinDir}/HitmanPro'.format(**vars) @@ -216,44 +106,6 @@ if __name__ == '__main__': download_file(_path, _name, _url) ## Driver Tools ## - # Acer Serial Number Detect Tool - _path = '{BinDir}/_Drivers'.format(**vars) - _name = 'Acer Serial Number Detect Tool.exe' - _url = 'http://global-download.acer.com/SupportFiles/Files/SNID/APP/SerialNumberDetectionTool.exe' - download_file(_path, _name, _url) - - # AMD Autodetect - _path = '{BinDir}/_Drivers'.format(**vars) - _name = 'AMD Autodetect.exe' - _url = 'http://www2.ati.com/drivers/auto/autodetectutility.exe' - download_file(_path, _name, _url) - - # AMD Gaming Evolved - _path = '{BinDir}/_Drivers'.format(**vars) - _name = 'AMD Gaming Evolved.exe' - _url = 'http://clientupdater.raptr.com/client/pc/amd/raptr_installer.exe' - download_file(_path, _name, _url) - - # Dell System Detect - _path = '{BinDir}/_Drivers'.format(**vars) - _name = 'Dell System Detect.exe' - _url = 'https://downloads.dell.com/tools/dellsystemdetect/dellsystemdetectlauncher.exe' - download_file(_path, _name, _url) - - #~Broken~# # GeForce Experience - #~Broken~# _path = '{BinDir}/_Drivers'.format(**vars) - #~Broken~# _name = 'GeForce Experience.exe' - #~Broken~# _dl_page = 'http://www.geforce.com/geforce-experience/download' - #~Broken~# _regex = r'href=.*http(s|)://us\.download\.nvidia\.com/GFE/GFEClient/[0-9\.]+/GeForce_Experience_v[0-9\.]+\.exe' - #~Broken~# _url = resolve_dynamic_url(_dl_page, _regex) - #~Broken~# download_file(_path, _name, _url) - - # HP Support Solutions Framework - _path = '{BinDir}/_Drivers'.format(**vars) - _name = 'HP Support Solutions Framework.exe' - _url = 'http://h20614.www2.hp.com/ediags/filehosting/api/installer' - download_file(_path, _name, _url) - # Intel Driver Update Utility _path = '{BinDir}/_Drivers'.format(**vars) _name = 'Intel Driver Update Utility.exe' @@ -274,12 +126,6 @@ if __name__ == '__main__': _url = _url.replace('%2F', '/') download_file(_path, _name, _url) - # Lenovo Service Bridge - _path = '{BinDir}/_Drivers'.format(**vars) - _name = 'Lenovo Service Bridge.exe' - _url = 'https://download.lenovo.com/lsb/LSBsetup.exe' - download_file(_path, _name, _url) - #~Broken~# # Samsung Magician print_warning('Samsung Magician section is broken.') print('Please manually put "Samsung Magician.exe" into "{BinDir}\\_Drivers\\"') @@ -310,12 +156,6 @@ if __name__ == '__main__': _url = 'http://mp3support.sandisk.com/ReadyCache/ExpressCacheSetup.exe' download_file(_path, _name, _url) - # Toshiba System Detect - _path = '{BinDir}/_Drivers'.format(**vars) - _name = 'Toshiba System Detect.exe' - _url = 'http://cdgenp01.csd.toshiba.com/content/support/downloads/GetProductInfo.exe' - download_file(_path, _name, _url) - ## Installers ## # Ninite - Bundles _path = '{BaseDir}/Installers/Extras/Bundles'.format(**vars) @@ -448,6 +288,24 @@ if __name__ == '__main__': download_file(_path, 'Google Chrome.exe', 'https://ninite.com/chrome/ninite.exe') download_file(_path, 'Mozilla Firefox.exe', 'https://ninite.com/firefox/ninite.exe') download_file(_path, 'Opera Chromium.exe', 'https://ninite.com/operaChromium/ninite.exe') + + ## Misc ## + # Sysinternals + _path = '{BinDir}/tmp'.format(**vars) + _name = 'SysinternalsSuite.zip' + _url = 'https://download.sysinternals.com/files/SysinternalsSuite.zip' + download_file(_path, _name, _url) + # Extract + _args = [ + 'e', '"{BinDir}/tmp/SysinternalsSuite.zip"'.format(**vars), + '-aoa', '-bso0', '-bsp0', + '-o"{BinDir}/SysinternalsSuite"'.format(**vars)] + run_program(seven_zip, _args) + try: + os.remove('{BinDir}/tmp/SysinternalsSuite.zip'.format(**vars)) + except: + pass pause("Press Enter to exit...") + kill_process('caffeine.exe') quit() diff --git a/.bin/Scripts/user_data.ps1 b/.bin/Scripts/user_data.ps1 deleted file mode 100644 index 14902981..00000000 --- a/.bin/Scripts/user_data.ps1 +++ /dev/null @@ -1,79 +0,0 @@ -# Wizard Kit: List the data usage for the current user (and other users when possible) - -param([string]$log) - -cd $(Split-Path $MyInvocation.MyCommand.Path) -. .\init.ps1 - -#Folder GUIDs from: https://msdn.microsoft.com/en-us/library/windows/desktop/dd378457(v=vs.85).aspx -$user_dirs = , ("Desktop", "{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}") -$user_dirs += , ("Documents", "Personal", "{FDD39AD0-238F-46AF-ADB4-6C85480369C7}") -$user_dirs += , ("Downloads", "{374DE290-123F-4565-9164-39C4925E467B}") -$user_dirs += , ("Favorites", "{1777F761-68AD-4D8A-87BD-30B759FA33DD}") -$user_dirs += , ("Music", "My Music", "{4BD8D571-6D19-48D3-BE97-422220080E43}") -$user_dirs += , ("Pictures", "My Pictures", "{33E28130-4E1E-4676-835A-98395C3BC3BB}") -$user_dirs += , ("Videos", "My Video", "{18989B1D-99B5-455B-841C-AB7C74E4DDFC}") -#=SkyDrive= -#=Dropbox= - -function print-dir-size ($name, $location) { - #"{0}: {1}" -f $name, $location - $name += ":" - $results = .\Get-FolderSize.ps1 "$location" - [int64]$bytes = $results.TotalBytes - if ($bytes -ge 1073741824) { - $total = "{0:N2}" -f [single]$results.TotalGBytes - $s = " {0} {1} Gb ({2})" -f $name.PadRight(10), $total.PadLeft(10), $location - } elseif ($bytes -ge 1048576) { - $total = "{0:N2}" -f [single]$results.TotalMBytes - $s = " {0} {1} Mb ({2})" -f $name.PadRight(10), $total.PadLeft(10), $location - } elseif ($bytes -ge 1024) { - $total = "{0:N2}" -f [single]($bytes/1024) - $s = " {0} {1} Kb ({2})" -f $name.PadRight(10), $total.PadLeft(10), $location - } else { - $total = "{0:N0}" -f $bytes - $s = " {0} {1} Bytes ({2})" -f $name.PadRight(10), $total.PadLeft(7), $location - } - WK-write "$s" "$log" -} - -foreach ($user in get-wmiobject -class win32_useraccount) { - if (test-path registry::hku\$($user.sid)) { - WK-write (" User: {0}" -f $user.name) "$log" - - # Profile - $user_profile = gp "registry::hklm\software\microsoft\windows nt\currentversion\profilelist\$($user.sid)" - print-dir-size "Profile" $user_profile.ProfileImagePath - WK-write " ------------------------" "$log" - - # Shell Folders - $shell_folders = gp "registry::hku\$($user.sid)\software\microsoft\windows\currentversion\explorer\shell folders" - foreach ($dir in $user_dirs) { - $dir_name = $dir[0] - foreach ($reg_name in $dir) { - $dir_location = $shell_folders.$reg_name - if ($dir_location -and $(test-path "$dir_location")) { - print-dir-size $dir_name $dir_location - break - } - } - } - - # Online Backups - foreach ($dir in "Dropbox", "Mozy", "OneDrive", "SkyDrive") { - $spacer = "True" - $dir_name = $dir - $dir_location = "{0}\{1}" -f $user_profile.ProfileImagePath, $dir - if (test-path $dir_location) { - if ($spacer) { - " ------------------------" - rv spacer - } - print-dir-size $dir_name $dir_location - } - } - - # Spacer - WK-write "" "$log" - } -} \ No newline at end of file diff --git a/.bin/Scripts/user_data_transfer.py b/.bin/Scripts/user_data_transfer.py index 5b1bb66b..2dcb68f0 100644 --- a/.bin/Scripts/user_data_transfer.py +++ b/.bin/Scripts/user_data_transfer.py @@ -8,50 +8,68 @@ from operator import itemgetter os.chdir(os.path.dirname(os.path.realpath(__file__))) os.system('title Wizard Kit: Data 1') from functions import * -vars = init_vars() -vars_os = init_vars_os() -vars['LogFile'] = '{LogDir}\\Data 1.log'.format(**vars) -os.makedirs('{LogDir}'.format(**vars), exist_ok=True) -vars['TransferDir'] = '{ClientDir}\\Transfer\\'.format(**vars) -os.makedirs('{TransferDir}'.format(**vars), exist_ok=True) -vars['FastCopy'] = '{BinDir}\\FastCopy\\FastCopy.exe'.format(**vars) -vars['FastCopyArgs'] = [ +vars_wk = init_vars_wk() +vars_wk.update(init_vars_os()) +vars_wk['LogFile'] = '{LogDir}\\Data 1.log'.format(**vars_wk) +os.makedirs('{LogDir}'.format(**vars_wk), exist_ok=True) +vars_wk['TransferDir'] = '{ClientDir}\\Transfer'.format(**vars_wk) +vars_wk['FastCopy'] = '{BinDir}\\FastCopy\\FastCopy.exe'.format(**vars_wk) +vars_wk['FastCopyArgs'] = [ '/cmd=noexist_only', - '/logfile={LogFile}'.format(**vars), + '/logfile={LogFile}'.format(**vars_wk), '/utf8', '/skip_empty_dir', '/linkdest', '/no_ui', '/auto_close', '/exclude=\\*.esd;\\*.swm;\\*.wim;\\*.dd;\\*.dd.tgz;\\*.dd.txz;\\*.map;\\*.dmg;\\*.image;$RECYCLE.BIN;$Recycle.Bin;.AppleDB;.AppleDesktop;.AppleDouble;.com.apple.timemachine.supported;.dbfseventsd;.DocumentRevisions-V100*;.DS_Store;.fseventsd;.PKInstallSandboxManager;.Spotlight*;.SymAV*;.symSchedScanLockxz;.TemporaryItems;.Trash*;.vol;.VolumeIcon.icns;desktop.ini;Desktop?DB;Desktop?DF;hiberfil.sys;lost+found;Network?Trash?Folder;pagefile.sys;Recycled;RECYCLER;System?Volume?Information;Temporary?Items;Thumbs.db'] -vars['Notepad2'] = '{BinDir}\\Notepad2\\Notepad2-Mod.exe'.format(**vars) -vars['wimlib-imagex'] = '{BinDir}\\wimlib\\x32\\wimlib-imagex.exe'.format(**vars) -if vars_os['Arch'] == 64: - vars['FastCopy'] = vars['FastCopy'].replace('FastCopy.exe', 'FastCopy64.exe') - vars['Notepad2'] = vars['Notepad2'].replace('Notepad2-Mod.exe', 'Notepad2-Mod64.exe') - vars['wimlib-imagex'] = vars['wimlib-imagex'].replace('x32', 'x64') -re_included_root_items = re.compile(r'(^\\((My\s*)|Downloads|Doc(uments?|s?)|WK(-Info|-Transfer|)|Media|Music|Pictures?|Videos?)$|^\\(ProgramData|Recovery|Temp.*|Users)$|(log|txt|rtf|qb\w*|avi|m4a|m4v|mp4|mkv|jpg|png|tiff?)$)', flags=re.IGNORECASE) -re_excluded_root_items = re.compile(r'(^\\boot(mgr|nxt)$|^\\(eula|globdata|install|vc_?red)|.*.sys$|^\\System Volume Information|RECYCLER|\$Recycle\.bin|^\\\$?Win(dows(.old|\.~BT|)$|RE_)|^\\PerfLogs|^\\Program Files|\.(esd|swm|wim|dd|map|dmg|image)$)', flags=re.IGNORECASE) +vars_wk['Notepad2'] = '{BinDir}\\Notepad2\\Notepad2-Mod.exe'.format(**vars_wk) +vars_wk['wimlib-imagex'] = '{BinDir}\\wimlib\\x32\\wimlib-imagex.exe'.format(**vars_wk) +if vars_wk['Arch'] == 64: + vars_wk['FastCopy'] = vars_wk['FastCopy'].replace('FastCopy.exe', 'FastCopy64.exe') + vars_wk['Notepad2'] = vars_wk['Notepad2'].replace('Notepad2-Mod.exe', 'Notepad2-Mod64.exe') + vars_wk['wimlib-imagex'] = vars_wk['wimlib-imagex'].replace('x32', 'x64') +re_included_root_items = re.compile(r'^\\(AdwCleaner|(My\s*|)(Doc(uments?( and Settings|)|s?)|Downloads|WK(-?Info|-?Transfer|)|Media|Music|Pic(ture|)s?|Vid(eo|)s?)|(ProgramData|Recovery|Temp.*|Users)$|.*\.(log|txt|rtf|qb\w*|avi|m4a|m4v|mp4|mkv|jpg|png|tiff?)$)', flags=re.IGNORECASE) +re_excluded_root_items = re.compile(r'^\\(boot(mgr|nxt)$|(eula|globdata|install|vc_?red)|.*.sys$|System Volume Information|RECYCLER|\$Recycle\.bin|\$?Win(dows(.old|\.~BT|)$|RE_)|\$GetCurrent|PerfLogs|Program Files|.*\.(esd|swm|wim|dd|map|dmg|image)$|SYSTEM.SAV|Windows10Upgrade)', flags=re.IGNORECASE) re_excluded_items = re.compile(r'^(\.(AppleDB|AppleDesktop|AppleDouble|com\.apple\.timemachine\.supported|dbfseventsd|DocumentRevisions-V100.*|DS_Store|fseventsd|PKInstallSandboxManager|Spotlight.*|SymAV.*|symSchedScanLockxz|TemporaryItems|Trash.*|vol|VolumeIcon\.icns)|desktop\.(ini|.*DB|.*DF)|(hiberfil|pagefile)\.sys|lost\+found|Network\.*Trash\.*Folder|Recycle[dr]|System\.*Volume\.*Information|Temporary\.*Items|Thumbs\.db)$', flags=re.IGNORECASE) +wim_included_extra_items = [ + 'AdwCleaner\\*log', + 'AdwCleaner\\*txt', + '\\Windows.old*\\Doc*', + '\\Windows.old*\\Download*', + '\\Windows.old*\\WK*', + '\\Windows.old*\\Media*', + '\\Windows.old*\\Music*', + '\\Windows.old*\\Pic*', + '\\Windows.old*\\ProgramData', + '\\Windows.old*\\Recovery', + '\\Windows.old*\\Temp*', + '\\Windows.old*\\Users', + '\\Windows.old*\\Vid*', + '\\Windows.old*\\Windows\\System32\\OEM', + '\\Windows.old*\\Windows\\System32\\config', + '\\Windows\\System32\\OEM', + '\\Windows\\System32\\config'] def abort(): - print_warning('Aborted.', log_file=vars['LogFile']) + print_warning('Aborted.', vars_wk['LogFile']) exit_script() def cleanup_transfer(): - """Walk through transfer folder (from the bottom) and remove extraneous items.""" - if os.path.exists(vars['TransferDir']): - for root, dirs, files in os.walk(vars['TransferDir'], topdown=False): + """Fix permissions and walk through transfer folder (from the bottom) and remove extraneous items.""" + run_program('attrib -a -h -r -s "{TransferDir}"'.format(**vars_wk), check=False) + if os.path.exists(vars_wk['TransferDir']): + for root, dirs, files in os.walk(vars_wk['TransferDir'], topdown=False): for name in dirs: + # Remove empty directories and junction points try: - # Removes empty directories and junction points os.rmdir(os.path.join(root, name)) except OSError: pass for name in files: + # Remove files based on exclusion regex if re_excluded_items.search(name): try: - # Removes files based on exclusion regex os.remove(os.path.join(root, name)) except OSError: pass @@ -59,99 +77,93 @@ def cleanup_transfer(): def exit_script(): umount_backup_shares() pause("Press Enter to exit...") - subprocess.Popen('"{Notepad2}" "{LogFile}"'.format(**vars)) + extract_item('Notepad2', vars_wk, silent=True) + subprocess.Popen('"{Notepad2}" "{LogFile}"'.format(**vars_wk)) quit() def is_valid_image(item): _valid = item.is_file() and re.search(r'\.wim$', item.name, flags=re.IGNORECASE) if _valid: try: - _cmd = [vars['wimlib-imagex'], 'info', '{image}'.format(image=item.path)] + _cmd = [vars_wk['wimlib-imagex'], 'info', '{image}'.format(image=item.path)] run_program(_cmd) except subprocess.CalledProcessError: _valid = False - print_warning('WARNING: Image damaged.', log_file=vars['LogFile']) + print_warning('WARNING: Image damaged.', vars_wk['LogFile']) time.sleep(2) return _valid -def transfer_file_based(restore_source): - # Registry - _args = vars['FastCopyArgs'].copy() - if os.path.exists('{source}\\Windows\\System32\\config'.format(source=restore_source.path)): - _args.append('{source}\\Windows\\System32\\config'.format(source=restore_source.path)) - if os.path.exists('{source}\\Windows\\System32\\OEM'.format(source=restore_source.path)): - _args.append('{source}\\Windows\\System32\\OEM'.format(source=restore_source.path)) - _args.append('/to={TransferDir}\\Windows\\System32\\'.format(**vars)) - try: - print_standard('Copying Windows Registry...', log_file=vars['LogFile']) - run_program(vars['FastCopy'], _args, check=True) - except subprocess.CalledProcessError: - print_warning('WARNING: Errors encountered while copying registry', log_file=vars['LogFile']) - - # Registry (Windows.old) - _args = vars['FastCopyArgs'].copy() - if os.path.exists('{source}\\Windows.old\\Windows\\System32\\config'.format(source=restore_source.path)): - _args.append('{source}\\Windows.old\\Windows\\System32\\config'.format(source=restore_source.path)) - if os.path.exists('{source}\\Windows.old\\Windows\\System32\\OEM'.format(source=restore_source.path)): - _args.append('{source}\\Windows.old\\Windows\\System32\\OEM'.format(source=restore_source.path)) - _args.append('/to={TransferDir}\\Windows.old\\Windows\\System32\\'.format(**vars)) - try: - print_standard('Copying Windows Registry...', log_file=vars['LogFile']) - run_program(vars['FastCopy'], _args, check=True) - except subprocess.CalledProcessError: - print_warning('WARNING: Errors encountered while copying registry', log_file=vars['LogFile']) +def transfer_file_based(source_path, subdir=None): + # Set Destination + if subdir is None: + dest_path = vars_wk['TransferDir'] + else: + dest_path = '{TransferDir}\\{subdir}'.format(subdir=subdir, **vars_wk) + os.makedirs(dest_path, exist_ok=True) # Main copy selected_items = [] - for item in os.scandir(restore_source.path): + for item in os.scandir(source_path): if re_included_root_items.search(item.name): selected_items.append(item.path) elif not re_excluded_root_items.search(item.name): if ask('Copy: "{name}" item?'.format(name=item.name)): selected_items.append(item.path) if len(selected_items) > 0: - _args = vars['FastCopyArgs'].copy() - _args += selected_items - _args.append('/to={TransferDir}\\'.format(**vars)) + _args = vars_wk['FastCopyArgs'].copy() + selected_items + _args.append('/to={dest_path}\\'.format(dest_path=dest_path)) try: - print_standard('Copying main user data...', log_file=vars['LogFile']) - run_program(vars['FastCopy'], _args, check=True) + print_standard('Copying main user data...', vars_wk['LogFile']) + run_program(vars_wk['FastCopy'], _args, check=True) except subprocess.CalledProcessError: - print_warning('WARNING: Errors encountered while copying main user data', log_file=vars['LogFile']) + print_warning('WARNING: Errors encountered while copying main user data', vars_wk['LogFile']) else: - print_error('ERROR: No files selected for transfer?', log_file=vars['LogFile']) + print_error('ERROR: No files selected for transfer?', vars_wk['LogFile']) abort() - - # Windows.old - selected_items = [] - for item in ['Users', 'ProgramData']: - item = '{source}\\Windows.old\\{item}'.format(source=restore_source.path, item=item) - if os.path.exists(item): - selected_items.append(item) - if len(selected_items) > 0: - _args = vars['FastCopyArgs'].copy() - _args += selected_items - _args.append('/to={TransferDir}\\Windows.old\\'.format(**vars)) - try: - print_standard('Copying user data (Windows.old)...', log_file=vars['LogFile']) - run_program(vars['FastCopy'], _args, check=True) - except subprocess.CalledProcessError: - print_warning('WARNING: Errors encountered while copying data from Windows.old', log_file=vars['LogFile']) -def transfer_image_based(restore_source): - print_standard('Assessing image...', log_file=vars['LogFile']) - + # Fonts + selected_items = [] + if os.path.exists('{source}\\Windows\\Fonts'.format(source=source_path)): + selected_items.append('{source}\\Windows\\Fonts'.format(source=source_path)) + if len(selected_items) > 0: + _args = vars_wk['FastCopyArgs'].copy() + selected_items + _args.append('/to={dest_path}\\Windows\\'.format(dest_path=dest_path)) + try: + print_standard('Copying Fonts...', vars_wk['LogFile']) + run_program(vars_wk['FastCopy'], _args, check=True) + except subprocess.CalledProcessError: + print_warning('WARNING: Errors encountered while copying Fonts', vars_wk['LogFile']) + + # Registry + selected_items = [] + if os.path.exists('{source}\\Windows\\System32\\config'.format(source=source_path)): + selected_items.append('{source}\\Windows\\System32\\config'.format(source=source_path)) + if os.path.exists('{source}\\Windows\\System32\\OEM'.format(source=source_path)): + selected_items.append('{source}\\Windows\\System32\\OEM'.format(source=source_path)) + if len(selected_items) > 0: + _args = vars_wk['FastCopyArgs'].copy() + selected_items + _args.append('/to={dest_path}\\Windows\\System32\\'.format(dest_path=dest_path)) + try: + print_standard('Copying Registry...', vars_wk['LogFile']) + run_program(vars_wk['FastCopy'], _args, check=True) + except subprocess.CalledProcessError: + print_warning('WARNING: Errors encountered while copying registry', vars_wk['LogFile']) + +def transfer_image_based(source_path): + print_standard('Assessing image...', vars_wk['LogFile']) + os.makedirs(vars_wk['TransferDir'], exist_ok=True) + # Scan source _args = [ 'dir', - '{source}'.format(source=restore_source.path), '1'] + '{source}'.format(source=source_path), '1'] try: - _list = run_program(vars['wimlib-imagex'], _args, check=True) + _list = run_program(vars_wk['wimlib-imagex'], _args, check=True) except subprocess.CalledProcessError as err: - print_error('ERROR: Failed to get file list.') + print_error('ERROR: Failed to get file list.', vars_wk['LogFile']) print(err) abort() - + # Add items to list selected_items = [] root_items = [i.strip() for i in _list.stdout.decode('utf-8', 'ignore').splitlines() if i.count('\\') == 1 and i.strip() != '\\'] @@ -161,54 +173,62 @@ def transfer_image_based(restore_source): elif not re_excluded_root_items.search(item): if ask('Extract: "{name}" item?'.format(name=item)): selected_items.append(item) - + # Extract files if len(selected_items) > 0: # Write files.txt - with open('{TmpDir}\\wim_files.txt'.format(**vars), 'w') as f: + with open('{TmpDir}\\wim_files.txt'.format(**vars_wk), 'w') as f: # Defaults - f.write('\\Windows.old\\WK*\n') - f.write('\\Windows.old\\ProgramData\n') - f.write('\\Windows.old\\Temp\n') - f.write('\\Windows.old\\Users\n') - f.write('\\Windows.old\\Windows\\System32\\config\n') - f.write('\\Windows.old\\Windows\\System32\\OEM\n') - f.write('\\Windows\\System32\\config\n') - f.write('\\Windows\\System32\\OEM\n') - f.write('AdwCleaner\\*log\n') - f.write('AdwCleaner\\*txt\n') + for item in wim_included_extra_items: + f.write('{item}\n'.format(item=item)) for item in selected_items: f.write('{item}\n'.format(item=item)) try: - print_standard('Extracting user data...', log_file=vars['LogFile']) + print_standard('Extracting user data...', vars_wk['LogFile']) _args = [ 'extract', - '{source}'.format(source=restore_source.path), '1', - '@{TmpDir}\\wim_files.txt'.format(**vars), - '--dest-dir={TransferDir}\\'.format(**vars), + '{source}'.format(source=source_path), '1', + '@{TmpDir}\\wim_files.txt'.format(**vars_wk), + '--dest-dir={TransferDir}\\'.format(**vars_wk), '--no-acls', '--nullglob'] - run_program(vars['wimlib-imagex'], _args, check=True) + run_program(vars_wk['wimlib-imagex'], _args, check=True) except subprocess.CalledProcessError: - print_warning('WARNING: Errors encountered while extracting user data', log_file=vars['LogFile']) + print_warning('WARNING: Errors encountered while extracting user data', vars_wk['LogFile']) else: - print_error('ERROR: No files selected for extraction?', log_file=vars['LogFile']) + print_error('ERROR: No files selected for extraction?', vars_wk['LogFile']) abort() if __name__ == '__main__': + stay_awake(vars_wk) + # Check for existing TransferDir + if os.path.exists(vars_wk['TransferDir']): + print_warning('Folder "{TransferDir}" exists. This script will rename the existing folder in order to avoid overwriting data.'.format(**vars_wk), vars_wk['LogFile']) + if (ask('Rename existing folder and proceed?', vars_wk['LogFile'])): + _old_transfer = '{TransferDir}.old'.format(**vars_wk) + _i = 1; + while os.path.exists(_old_transfer): + _old_transfer = '{TransferDir}.old{i}'.format(i=_i, **vars_wk) + _i += 1 + print_info('Renaming "{TransferDir}" to "{old_transfer}"'.format(old_transfer=_old_transfer, **vars_wk), vars_wk['LogFile']) + os.rename(vars_wk['TransferDir'], _old_transfer) + else: + abort() + # Set ticket number ticket = None while ticket is None: tmp = input('Enter ticket number: ') if re.match(r'^([0-9]+([-_]?\w+|))$', tmp): ticket = tmp - + # Get backup backup_source = select_backup(ticket) if backup_source is None: abort() - + # Determine restore method + extract_item('wimlib', vars_wk, silent=True) restore_source = None restore_options = [] _file_based = False @@ -232,17 +252,22 @@ if __name__ == '__main__': else: restore_source = restore_options[int(selection)-1]['Source'] else: - print_error('ERROR: No restoration options detected.', log_file=vars['LogFile']) + print_error('ERROR: No restoration options detected.', vars_wk['LogFile']) abort() - + # Start transfer - print_info('Using backup: {path}'.format(path=restore_source.path), log_file=vars['LogFile']) + print_info('Using backup: {path}'.format(path=restore_source.path), vars_wk['LogFile']) if restore_source.is_dir(): - transfer_file_based(restore_source) + transfer_file_based(restore_source.path) + # Check for Windows.old* + for item in os.scandir(restore_source.path): + if item.is_dir() and re.search(r'^Windows.old', item.name, re.IGNORECASE): + transfer_file_based(item.path, subdir=item.name) if restore_source.is_file(): - transfer_image_based(restore_source) + transfer_image_based(restore_source.path) cleanup_transfer() - + # Done - print_success('Done.', log_file=vars['LogFile']) - exit_script() \ No newline at end of file + print_success('Done.', vars_wk['LogFile']) + kill_process('caffeine.exe') + exit_script() diff --git a/.bin/Scripts/wk_info.cmd b/.bin/Scripts/wk_info.cmd deleted file mode 100644 index e8bcb7cb..00000000 --- a/.bin/Scripts/wk_info.cmd +++ /dev/null @@ -1,36 +0,0 @@ -@echo off - -rem Set date variable and create WK\Info\%date% - -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:GetDate -:: Credit to SS64.com Code taken from http://ss64.com/nt/syntax-getdate.html -:: Use WMIC to retrieve date and time in ISO 8601 format. -FOR /F "skip=1 tokens=1-6" %%G IN ('WMIC Path Win32_LocalTime Get Day^,Hour^,Minute^,Month^,Second^,Year /Format:table') DO ( -IF "%%~L"=="" goto s_done - Set _yyyy=%%L - Set _mm=00%%J - Set _dd=00%%G - Set _hour=00%%H - SET _minute=00%%I -) -:s_done -:: Pad digits with leading zeros -Set _mm=%_mm:~-2% -Set _dd=%_dd:~-2% -Set _hour=%_hour:~-2% -Set _minute=%_minute:~-2% -Set iso_date=%_yyyy%-%_mm%-%_dd% - -:CreateInfoDir -set "log_dir=%systemdrive%\WK\Info\%iso_date%" -mkdir "%log_dir%">nul 2>&1 - -:Done -goto Exit - -:Exit \ No newline at end of file diff --git a/Activate Windows.cmd b/Activate Windows.cmd index 4a9a01d5..5787be18 100644 --- a/Activate Windows.cmd +++ b/Activate Windows.cmd @@ -1,31 +1,111 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +: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=PyScript +set L_PATH=Scripts +set L_ITEM=activate.py +set L_ARGS= +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 -call "%bin%\Scripts\Launch.cmd" PyScript "%bin%\Scripts" "activate.py" /admin +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Copy WizardKit.cmd b/Copy WizardKit.cmd new file mode 100644 index 00000000..21b251a9 --- /dev/null +++ b/Copy WizardKit.cmd @@ -0,0 +1,132 @@ +:: Wizard Kit: Copy Kit :: +@echo off + +:Init +setlocal +title Wizard Kit: Tools Copier +color 1b +echo Initializing... +call :CheckFlags %* +call :FindBin + +:SetVariables +set "ARCHIVE_PASS=Abracadabra" +rem Set ARCH to 32 as a gross assumption and check for x86_64 status +set ARCH=32 +if /i "%PROCESSOR_ARCHITECTURE%" == "AMD64" set "ARCH=64" +set "SEVEN_ZIP=%bin%\7-Zip\7za.exe" +set "CON=%bin%\ConEmu\ConEmu.exe" +set "FASTCOPY=%bin%\FastCopy\FastCopy.exe" +if %ARCH% equ 64 ( + set "SEVEN_ZIP=%bin%\7-Zip\7za64.exe" + set "CON=%bin%\ConEmu\ConEmu64.exe" + set "FASTCOPY=%bin%\FastCopy\FastCopy64.exe" +) +set "fastcopy_args=/cmd=diff /no_ui /auto_close" +rem Set %client_dir% +call "%bin%\Scripts\init_client_dir.cmd" +pushd "%bin%\.." +set "source=%cd%" +popd +set "dest=%client_dir%\Tools" + +:RelaunchInConEmu +if not defined IN_CONEMU ( + if not defined L_NCMD ( + set "con_args=-new_console:n" + rem If in DEBUG state then force ConEmu to stay open + if defined DEBUG (set "con_args=!con_args! -new_console:c") + set IN_CONEMU=True + start "" "%CON%" -run ""%~0" %*" !con_args! || goto ErrorUnknown + exit /b 0 + ) +) +:CopyBin +echo Copying .bin... +mkdir "%dest%\.bin" >nul 2>&1 +attrib +h "%dest%\.bin" +set _sources="%bin%\7-Zip" +set _sources=%_sources% "%bin%\ConEmu" +set _sources=%_sources% "%bin%\FastCopy" +set _sources=%_sources% "%bin%\HWiNFO" +set _sources=%_sources% "%bin%\Python" +set _sources=%_sources% "%bin%\Scripts" +start "" /wait "%fastcopy%" %fastcopy_args% %_sources% /to="%dest%\.bin\" + +:CopyCBin +echo Copying .cbin... +mkdir "%dest%\.cbin" >nul 2>&1 +attrib +h "%dest%\.cbin" +start "" /wait "%fastcopy%" %fastcopy_args% %cbin%\* /to="%dest%\.cbin\" + +:CopyMainData +echo Copying Main Kit... +set _sources="%source%\Data Transfers & DSR" +set _sources=%_sources% "%source%\Diagnostics" +set _sources=%_sources% "%source%\Drivers" +set _sources=%_sources% "%source%\Installers" +set _sources=%_sources% "%source%\Misc" +set _sources=%_sources% "%source%\OSR & VR" +set _sources=%_sources% "%source%\Uninstallers" +set _sources=%_sources% "%source%\Activate Windows.cmd" +set _sources=%_sources% "%source%\Enter SafeMode.cmd" +set _sources=%_sources% "%source%\Exit SafeMode.cmd" +set _sources=%_sources% "%source%\Reset Browsers.cmd" +set _sources=%_sources% "%source%\SW Diagnostics.cmd" +set _sources=%_sources% "%source%\SW Final Checklist.cmd" +start "" /wait "%fastcopy%" %fastcopy_args% /exclude="Snappy Driver Installer.cmd;*.exe" %_sources% /to="%dest%\" +start "" /wait "%fastcopy%" %fastcopy_args% "%source%\Installers\Extras\Office\Adobe Reader DC.exe" /to="%dest%\Installers\Extras\Office\" + +:Ninite +echo Extracting Ninite installers... +"%SEVEN_ZIP%" x "%cbin%\_Ninite.7z" -aoa -bso0 -bse0 -bsp0 -p%ARCHIVE_PASS% -o"%dest%\Installers\Extras" || goto Abort + +:OpenFolder +start "" explorer "%dest%" +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 :: +:ErrorNoBin +echo. +echo ERROR: ".bin" folder not found. +goto Abort + +:Abort +color 4e +echo Aborted. +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% diff --git a/Copy-WizardKit.cmd b/Copy-WizardKit.cmd deleted file mode 100644 index 227ab0da..00000000 --- a/Copy-WizardKit.cmd +++ /dev/null @@ -1,81 +0,0 @@ -@echo off - -:Flags -set silent= -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:Init -setlocal EnableDelayedExpansion -title Wizard Kit: Tools Copier -color 1b -echo Initializing... - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - -:SetVariables -if /i "!PROCESSOR_ARCHITECTURE!" == "AMD64" set "arch=64" -set "fastcopy=%bin%\FastCopy\FastCopy.exe" -if !arch! equ 64 ( - set "fastcopy=%bin%\FastCopy\FastCopy64.exe" -) -set "fastcopy_args=/cmd=diff /no_ui /auto_close" -rem Set %client_dir% -call "%bin%\Scripts\init_client_dir.cmd" -pushd "%bin%\.." -set "source=%cd%" -set "dest=%client_dir%\Tools" - -:CopyFiles -echo Copying data... -rem .bin -start "" /wait "%fastcopy%" %fastcopy_args% /exclude="\_Drivers\SDI\" "%bin%\*" /to="%dest%\.bin\" - -rem RKill links -pushd "!dest!\.bin\RKill" -mklink /h explorer.exe RKill.exe >nul 2>&1 -mklink /h iExplore.exe RKill.exe >nul 2>&1 -mklink /h RKill.com RKill.exe >nul 2>&1 -mklink /h RKill.scr RKill.exe >nul 2>&1 -mklink /h uSeRiNiT.exe RKill.exe >nul 2>&1 -mklink /h WiNlOgOn.exe RKill.exe >nul 2>&1 -popd - -rem Everything else -start "" /wait "%fastcopy%" %fastcopy_args% /exclude="\.bin\;\.git\;\Data Recovery\;\Copy-WizardKit.cmd;\Drivers\Auto Detect - SDI.cmd" "%source%" /to="%dest%\" - -:OpenFolder -start "" explorer "!dest!" -goto Done - -:ErrorNoBin -popd -echo ERROR: ".bin" folder not found.. -goto Abort - -:Abort -color 4e -echo. -echo Aborted. -echo. -echo Press any key to exit... -pause>nul -goto Exit - -:Done -echo. -echo Done. -goto Exit - -:Exit -popd -color -endlocal diff --git a/Data Recovery/PhotoRec (CLI).cmd b/Data Recovery/PhotoRec (CLI).cmd index 1e8ac85a..9e11e6c4 100644 --- a/Data Recovery/PhotoRec (CLI).cmd +++ b/Data Recovery/PhotoRec (CLI).cmd @@ -1,31 +1,111 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +: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=Console +set L_PATH=TestDisk +set L_ITEM=photorec_win.exe +set L_ARGS= +set L_7ZIP= +set L_CHCK=True +set L_ELEV=True +set L_NCMD= +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 -call "%bin%\Scripts\Launch.cmd" Console "%bin%\TestDisk" "photorec_win.exe" "" /admin +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Data Recovery/PhotoRec.cmd b/Data Recovery/PhotoRec.cmd index 604ce38b..2693c369 100644 --- a/Data Recovery/PhotoRec.cmd +++ b/Data Recovery/PhotoRec.cmd @@ -1,31 +1,111 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +: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=Console +set L_PATH=TestDisk +set L_ITEM=qphotorec_win.exe +set L_ARGS= +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 -call "%bin%\Scripts\Launch.cmd" Program "%bin%\TestDisk" "qphotorec_win.exe" "" /admin +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Data Recovery/TestDisk.cmd b/Data Recovery/TestDisk.cmd index f26a09fe..68e02164 100644 --- a/Data Recovery/TestDisk.cmd +++ b/Data Recovery/TestDisk.cmd @@ -1,31 +1,111 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +: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=Console +set L_PATH=TestDisk +set L_ITEM=testdisk_win.exe +set L_ARGS= +set L_7ZIP= +set L_CHCK=True +set L_ELEV=True +set L_NCMD= +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 -call "%bin%\Scripts\Launch.cmd" Console "%bin%\TestDisk" "testdisk_win.exe" "" /admin +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Data Transfers/Explorer++.cmd b/Data Transfers/Explorer++.cmd deleted file mode 100644 index c82029bc..00000000 --- a/Data Transfers/Explorer++.cmd +++ /dev/null @@ -1,31 +0,0 @@ -@echo off - -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - -:Launch -call "%bin%\Scripts\Launch.cmd" Program "%bin%\Explorer++" "Explorer++.exe" "%userprofile%" /max -goto Exit - -:ErrorNoBin -popd -color 4e -echo ".bin" folder not found, aborting script. -echo. -echo Press any key to exit... -pause>nul -color -goto Exit - -:Exit diff --git a/Data Transfers/FastCopy (as ADMIN).cmd b/Data Transfers/FastCopy (as ADMIN).cmd index 97144940..68b15d5f 100644 --- a/Data Transfers/FastCopy (as ADMIN).cmd +++ b/Data Transfers/FastCopy (as ADMIN).cmd @@ -1,35 +1,112 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - -:CreateInfoDir -rem Create %client_dir%\Info\YYYY-MM-DD and set path as %log_dir% +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin call "%bin%\Scripts\init_client_dir.cmd" /Info /Transfer +: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=FastCopy +set L_ITEM=FastCopy.exe +set L_ARGS=/logfile=%log_dir%\FastCopy.log /cmd=noexist_only /utf8 /skip_empty_dir /linkdest /exclude=$RECYCLE.BIN;$Recycle.Bin;.AppleDB;.AppleDesktop;.AppleDouble;.com.apple.timemachine.supported;.dbfseventsd;.DocumentRevisions-V100*;.DS_Store;.fseventsd;.PKInstallSandboxManager;.Spotlight*;.SymAV*;.symSchedScanLockxz;.TemporaryItems;.Trash*;.vol;.VolumeIcon.icns;desktop.ini;Desktop?DB;Desktop?DF;hiberfil.sys;lost+found;Network?Trash?Folder;pagefile.sys;Recycled;RECYCLER;System?Volume?Information;Temporary?Items;Thumbs.db /to=%client_dir%\Transfer\ +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 -call "%bin%\Scripts\Launch.cmd" Program "%bin%\FastCopy" "FastCopy.exe" "/logfile=%log_dir%\FastCopy.log /cmd=noexist_only /utf8 /skip_empty_dir /linkdest /exclude=$RECYCLE.BIN;$Recycle.Bin;.AppleDB;.AppleDesktop;.AppleDouble;.com.apple.timemachine.supported;.dbfseventsd;.DocumentRevisions-V100*;.DS_Store;.fseventsd;.PKInstallSandboxManager;.Spotlight*;.SymAV*;.symSchedScanLockxz;.TemporaryItems;.Trash*;.vol;.VolumeIcon.icns;desktop.ini;Desktop?DB;Desktop?DF;hiberfil.sys;lost+found;Network?Trash?Folder;pagefile.sys;Recycled;RECYCLER;System?Volume?Information;Temporary?Items;Thumbs.db /to=%client_dir%\Transfer\" /admin +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Data Transfers/FastCopy.cmd b/Data Transfers/FastCopy.cmd index 1bb07de2..d4467aea 100644 --- a/Data Transfers/FastCopy.cmd +++ b/Data Transfers/FastCopy.cmd @@ -1,35 +1,112 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - -:CreateInfoDir -rem Create %client_dir%\Info\YYYY-MM-DD and set path as %log_dir% +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin call "%bin%\Scripts\init_client_dir.cmd" /Info /Transfer +: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=FastCopy +set L_ITEM=FastCopy.exe +set L_ARGS=/logfile=%log_dir%\FastCopy.log /cmd=noexist_only /utf8 /skip_empty_dir /linkdest /exclude=$RECYCLE.BIN;$Recycle.Bin;.AppleDB;.AppleDesktop;.AppleDouble;.com.apple.timemachine.supported;.dbfseventsd;.DocumentRevisions-V100*;.DS_Store;.fseventsd;.PKInstallSandboxManager;.Spotlight*;.SymAV*;.symSchedScanLockxz;.TemporaryItems;.Trash*;.vol;.VolumeIcon.icns;desktop.ini;Desktop?DB;Desktop?DF;hiberfil.sys;lost+found;Network?Trash?Folder;pagefile.sys;Recycled;RECYCLER;System?Volume?Information;Temporary?Items;Thumbs.db /to=%client_dir%\Transfer\ +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 -call "%bin%\Scripts\Launch.cmd" Program "%bin%\FastCopy" "FastCopy.exe" "/logfile=%log_dir%\FastCopy.log /cmd=noexist_only /utf8 /skip_empty_dir /linkdest /exclude=$RECYCLE.BIN;$Recycle.Bin;.AppleDB;.AppleDesktop;.AppleDouble;.com.apple.timemachine.supported;.dbfseventsd;.DocumentRevisions-V100*;.DS_Store;.fseventsd;.PKInstallSandboxManager;.Spotlight*;.SymAV*;.symSchedScanLockxz;.TemporaryItems;.Trash*;.vol;.VolumeIcon.icns;desktop.ini;Desktop?DB;Desktop?DF;hiberfil.sys;lost+found;Network?Trash?Folder;pagefile.sys;Recycled;RECYCLER;System?Volume?Information;Temporary?Items;Thumbs.db /to=%client_dir%\Transfer\" +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Data Transfers/KVRT.cmd b/Data Transfers/KVRT.cmd index 7d5051d8..67884371 100644 --- a/Data Transfers/KVRT.cmd +++ b/Data Transfers/KVRT.cmd @@ -1,37 +1,114 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - :Init -rem Set %client_dir% +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin 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 -call "%bin%\Scripts\Launch.cmd" Program "%bin%" "KVRT.exe" "-accepteula -d %q_dir% -processlevel 3 -dontcryptsupportinfo -fixednames" +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Data Transfers/Q-Dir (as ADMIN).cmd b/Data Transfers/Q-Dir (as ADMIN).cmd new file mode 100644 index 00000000..cf31d73c --- /dev/null +++ b/Data Transfers/Q-Dir (as ADMIN).cmd @@ -0,0 +1,111 @@ +:: 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% \ No newline at end of file diff --git a/Data Transfers/Q-Dir.cmd b/Data Transfers/Q-Dir.cmd index 3c4daa41..3a13302d 100644 --- a/Data Transfers/Q-Dir.cmd +++ b/Data Transfers/Q-Dir.cmd @@ -1,31 +1,111 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +: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= +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 -call "%bin%\Scripts\Launch.cmd" Program "%bin%\Q-Dir" "Q-Dir.exe" "%userprofile%" /max +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Data Transfers/Transferred Keys.cmd b/Data Transfers/Transferred Keys.cmd index d9e867db..2f5d4e9f 100644 --- a/Data Transfers/Transferred Keys.cmd +++ b/Data Transfers/Transferred Keys.cmd @@ -1,31 +1,111 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +: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=PyScript +set L_PATH=Scripts +set L_ITEM=transferred_keys.py +set L_ARGS= +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 -call "%bin%\Scripts\Launch.cmd" Console "%bin%\Scripts" "transferred_keys.cmd" /admin +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Data Transfers/User Data Transfer.cmd b/Data Transfers/User Data Transfer.cmd index 7f9dc352..a40b82eb 100644 --- a/Data Transfers/User Data Transfer.cmd +++ b/Data Transfers/User Data Transfer.cmd @@ -1,31 +1,111 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +: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=PyScript +set L_PATH=Scripts +set L_ITEM=user_data_transfer.py +set L_ARGS= +set L_7ZIP= +set L_CHCK=True +set L_ELEV= +set L_NCMD= +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 -call "%bin%\Scripts\Launch.cmd" PyScript "%bin%\Scripts" "user_data_transfer.py" +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Diagnostics/AIDA64 (Deprecated).cmd b/Diagnostics/AIDA64 (Deprecated).cmd new file mode 100644 index 00000000..c0b4b08d --- /dev/null +++ b/Diagnostics/AIDA64 (Deprecated).cmd @@ -0,0 +1,111 @@ +:: 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=AIDA64 +set L_ITEM=aida64.exe +set L_ARGS= +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% \ No newline at end of file diff --git a/Diagnostics/AIDA64.cmd b/Diagnostics/AIDA64.cmd deleted file mode 100644 index 90638a4d..00000000 --- a/Diagnostics/AIDA64.cmd +++ /dev/null @@ -1,31 +0,0 @@ -@echo off - -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - -:Launch -call "%bin%\Scripts\Launch.cmd" Program "%bin%\AIDA64" "aida64.exe" "" /admin -goto Exit - -:ErrorNoBin -popd -color 4e -echo ".bin" folder not found, aborting script. -echo. -echo Press any key to exit... -pause>nul -color -goto Exit - -:Exit diff --git a/Diagnostics/BatteryInfoView.cmd b/Diagnostics/BatteryInfoView.cmd deleted file mode 100644 index 93a73734..00000000 --- a/Diagnostics/BatteryInfoView.cmd +++ /dev/null @@ -1,31 +0,0 @@ -@echo off - -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - -:Launch -call "%bin%\Scripts\Launch.cmd" Program "%bin%\BatteryInfoView" "BatteryInfoView.exe" "" /admin -goto Exit - -:ErrorNoBin -popd -color 4e -echo ".bin" folder not found, aborting script. -echo. -echo Press any key to exit... -pause>nul -color -goto Exit - -:Exit diff --git a/Diagnostics/BleachBit.cmd b/Diagnostics/BleachBit.cmd index e1751888..d205fdd6 100644 --- a/Diagnostics/BleachBit.cmd +++ b/Diagnostics/BleachBit.cmd @@ -1,31 +1,111 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +: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=BleachBit +set L_ITEM=bleachbit.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 -call "%bin%\Scripts\Launch.cmd" Program "%bin%\BleachBit" "bleachbit.exe" "" /admin +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Diagnostics/BlueScreenView.cmd b/Diagnostics/BlueScreenView.cmd deleted file mode 100644 index b5c903e2..00000000 --- a/Diagnostics/BlueScreenView.cmd +++ /dev/null @@ -1,31 +0,0 @@ -@echo off - -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - -:Launch -call "%bin%\Scripts\Launch.cmd" Program "%bin%\BlueScreenView" "BlueScreenView.exe" "" /admin -goto Exit - -:ErrorNoBin -popd -color 4e -echo ".bin" folder not found, aborting script. -echo. -echo Press any key to exit... -pause>nul -color -goto Exit - -:Exit diff --git a/Diagnostics/Extras/Auslogics DiskDefrag.cmd b/Diagnostics/Extras/Auslogics DiskDefrag.cmd index a03dbf39..fbf1512e 100644 --- a/Diagnostics/Extras/Auslogics DiskDefrag.cmd +++ b/Diagnostics/Extras/Auslogics DiskDefrag.cmd @@ -1,31 +1,111 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +: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=Auslogics DiskDefrag +set L_ITEM=DiskDefrag.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 -call "%bin%\Scripts\Launch.cmd" Program "%bin%\Auslogics DiskDefrag" "DiskDefrag.exe" "" /admin +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Diagnostics/Extras/Autoruns (with VirusTotal Scan).cmd b/Diagnostics/Extras/Autoruns (with VirusTotal Scan).cmd index 68c00c67..6be6d6d6 100644 --- a/Diagnostics/Extras/Autoruns (with VirusTotal Scan).cmd +++ b/Diagnostics/Extras/Autoruns (with VirusTotal Scan).cmd @@ -1,20 +1,17 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - -:ModifySettings +:Configure reg add HKCU\Software\Sysinternals\AutoRuns /v checkvirustotal /t REG_DWORD /d 1 /f >nul reg add HKCU\Software\Sysinternals\AutoRuns /v EulaAccepted /t REG_DWORD /d 1 /f >nul reg add HKCU\Software\Sysinternals\AutoRuns /v shownomicrosoft /t REG_DWORD /d 1 /f >nul @@ -26,18 +23,101 @@ reg add HKCU\Software\Sysinternals\AutoRuns\SigCheck /v EulaAccepted /t REG_DWOR reg add HKCU\Software\Sysinternals\AutoRuns\Streams /v EulaAccepted /t REG_DWORD /d 1 /f >nul reg add HKCU\Software\Sysinternals\AutoRuns\VirusTotal /v VirusTotalTermsAccepted /t REG_DWORD /d 1 /f >nul +: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=SysinternalsSuite +set L_ITEM=Autoruns.exe +set L_ARGS=-e +set L_7ZIP=Autoruns* +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 -call "%bin%\Scripts\Launch.cmd" Program "%bin%\SysinternalsSuite" "Autoruns.exe" "-e" +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Diagnostics/Extras/BIOSCodes.cmd b/Diagnostics/Extras/BIOSCodes.cmd index 81674083..9de2ce3d 100644 --- a/Diagnostics/Extras/BIOSCodes.cmd +++ b/Diagnostics/Extras/BIOSCodes.cmd @@ -1,31 +1,111 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +: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=BIOSCodes +set L_ITEM=BIOSCodes.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 -call "%bin%\Scripts\Launch.cmd" Program "%bin%\BIOSCodes" "BIOSCodes.exe" "" +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Diagnostics/Extras/BatteryInfoView.cmd b/Diagnostics/Extras/BatteryInfoView.cmd new file mode 100644 index 00000000..9ee208d1 --- /dev/null +++ b/Diagnostics/Extras/BatteryInfoView.cmd @@ -0,0 +1,111 @@ +:: 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=BatteryInfoView +set L_ITEM=BatteryInfoView.exe +set L_ARGS= +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% \ No newline at end of file diff --git a/Diagnostics/Extras/BlueScreenView.cmd b/Diagnostics/Extras/BlueScreenView.cmd new file mode 100644 index 00000000..c34c5b1b --- /dev/null +++ b/Diagnostics/Extras/BlueScreenView.cmd @@ -0,0 +1,111 @@ +:: 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=BlueScreenView +set L_ITEM=BlueScreenView.exe +set L_ARGS= +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% \ No newline at end of file diff --git a/Diagnostics/Extras/CPU-Z.cmd b/Diagnostics/Extras/CPU-Z.cmd index 984560d7..0c22dfe0 100644 --- a/Diagnostics/Extras/CPU-Z.cmd +++ b/Diagnostics/Extras/CPU-Z.cmd @@ -1,31 +1,111 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +: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=CPU-Z +set L_ITEM=cpuz.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 -call "%bin%\Scripts\Launch.cmd" Program "%bin%\CPU-Z" "cpuz.exe" "" +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Diagnostics/Extras/ERUNT.cmd b/Diagnostics/Extras/ERUNT.cmd index c1ef3e4e..ab0472f8 100644 --- a/Diagnostics/Extras/ERUNT.cmd +++ b/Diagnostics/Extras/ERUNT.cmd @@ -1,35 +1,112 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - :Init -rem Create %client_dir%\Info\YYYY-MM-DD and set path as %log_dir% +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin call "%bin%\Scripts\init_client_dir.cmd" /Info +: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=erunt +set L_ITEM=ERUNT.EXE +set L_ARGS=%log_dir%\Registry sysreg curuser otherusers +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 -call "%bin%\Scripts\Launch.cmd" Program "%bin%\erunt" "ERUNT.EXE" "%log_dir%%\Registry sysreg curuser otherusers" /admin +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Diagnostics/Extras/HWMonitor (Deprecated).cmd b/Diagnostics/Extras/HWMonitor (Deprecated).cmd new file mode 100644 index 00000000..b4b23375 --- /dev/null +++ b/Diagnostics/Extras/HWMonitor (Deprecated).cmd @@ -0,0 +1,111 @@ +:: 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=HWMonitor +set L_ITEM=HWMonitor.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% \ No newline at end of file diff --git a/Diagnostics/Extras/HeavyLoad.cmd b/Diagnostics/Extras/HeavyLoad.cmd index 5ff4aa41..3a741985 100644 --- a/Diagnostics/Extras/HeavyLoad.cmd +++ b/Diagnostics/Extras/HeavyLoad.cmd @@ -1,31 +1,111 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +: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=HeavyLoad +set L_ITEM=HeavyLoad.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 -call "%bin%\Scripts\Launch.cmd" Program "%bin%\HeavyLoad" "HeavyLoad.exe" "" /admin +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Diagnostics/Extras/HitmanPro (FullBreach).cmd b/Diagnostics/Extras/HitmanPro (FullBreach).cmd index 147ff089..eb60c70c 100644 --- a/Diagnostics/Extras/HitmanPro (FullBreach).cmd +++ b/Diagnostics/Extras/HitmanPro (FullBreach).cmd @@ -1,35 +1,112 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - -:CreateInfoDir -rem Create %client_dir%\Info\YYYY-MM-DD and set path as %log_dir% +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin call "%bin%\Scripts\init_client_dir.cmd" /Info +: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=HitmanPro +set L_ITEM=HitmanPro.exe +set L_ARGS=/scan /noinstall /noupload /log=%log_dir%\hitman.xml /fb +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 -call "%bin%\Scripts\Launch.cmd" Program "%bin%\HitmanPro" "HitmanPro.exe" "/scan /noinstall /noupload /log=%log_dir%\hitman.xml /fb" /admin +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Diagnostics/Extras/MailPasswordView (as ADMIN).cmd b/Diagnostics/Extras/MailPasswordView (as ADMIN).cmd index e54b87d7..b4a8c1b3 100644 --- a/Diagnostics/Extras/MailPasswordView (as ADMIN).cmd +++ b/Diagnostics/Extras/MailPasswordView (as ADMIN).cmd @@ -1,43 +1,111 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - :Init -setlocal enabledelayedexpansion +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:Extract -mkdir "%bin%\tmp" >nul 2>&1 -call "%bin%\Scripts\Launch.cmd" Program "%bin%" "%bin%\7-Zip\7za.exe" "x mailpv.7z -otmp -aoa -pAbracadabra -bsp0 -bso0" /wait -ping -n 2 127.0.0.1>nul +: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=Mail PassView +set L_ITEM=mailpv.exe +set L_ARGS= +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 -call "%bin%\Scripts\Launch.cmd" Program "%bin%\tmp" "mailpv.exe" "" /admin - -:Done -popd -endlocal +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% diff --git a/Diagnostics/Extras/MailPasswordView.cmd b/Diagnostics/Extras/MailPasswordView.cmd index 3f50b538..4ec5307f 100644 --- a/Diagnostics/Extras/MailPasswordView.cmd +++ b/Diagnostics/Extras/MailPasswordView.cmd @@ -1,43 +1,111 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - :Init -setlocal enabledelayedexpansion +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:Extract -mkdir "%bin%\tmp" >nul 2>&1 -call "%bin%\Scripts\Launch.cmd" Program "%bin%" "%bin%\7-Zip\7za.exe" "x mailpv.7z -otmp -aoa -pAbracadabra -bsp0 -bso0" /wait -ping -n 2 127.0.0.1>nul +: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=Mail PassView +set L_ITEM=mailpv.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 -call "%bin%\Scripts\Launch.cmd" Program "%bin%\tmp" "mailpv.exe" "" - -:Done -popd -endlocal +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% diff --git a/Diagnostics/GpuTest.cmd b/Diagnostics/GpuTest.cmd index 39bfb9a7..0255b8c6 100644 --- a/Diagnostics/GpuTest.cmd +++ b/Diagnostics/GpuTest.cmd @@ -1,31 +1,111 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +: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=GpuTest +set L_ITEM=GpuTest_GUI.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 -call "%bin%\Scripts\Launch.cmd" Program "%bin%\GpuTest" "GpuTest_GUI.exe" "" +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Diagnostics/HWMonitor.cmd b/Diagnostics/HWMonitor.cmd deleted file mode 100644 index 1a065e43..00000000 --- a/Diagnostics/HWMonitor.cmd +++ /dev/null @@ -1,31 +0,0 @@ -@echo off - -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - -:Launch -call "%bin%\Scripts\Launch.cmd" Program "%bin%\HWMonitor" "HWMonitor.exe" "" -goto Exit - -:ErrorNoBin -popd -color 4e -echo ".bin" folder not found, aborting script. -echo. -echo Press any key to exit... -pause>nul -color -goto Exit - -:Exit diff --git a/Diagnostics/HWiNFO (Sensors).cmd b/Diagnostics/HWiNFO (Sensors).cmd index bde9f5a7..ce6bcb0e 100644 --- a/Diagnostics/HWiNFO (Sensors).cmd +++ b/Diagnostics/HWiNFO (Sensors).cmd @@ -1,18 +1,15 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin :Configure rem just configure for both x32 & x64 @@ -22,18 +19,101 @@ for %%a in (32 64) do ( (echo SummaryOnly=0)>>"%bin%\HWiNFO\HWiNFO%%a.ini" ) +: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=HWiNFO +set L_ITEM=HWiNFO.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 -call "%bin%\Scripts\Launch.cmd" Program "%bin%\HWiNFO" "HWiNFO.exe" "" +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Diagnostics/HWiNFO.cmd b/Diagnostics/HWiNFO.cmd index fdda567b..0084eeae 100644 --- a/Diagnostics/HWiNFO.cmd +++ b/Diagnostics/HWiNFO.cmd @@ -1,18 +1,15 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin :Configure rem just configure for both x32 & x64 @@ -22,18 +19,101 @@ for %%a in (32 64) do ( (echo SummaryOnly=0)>>"%bin%\HWiNFO\HWiNFO%%a.ini" ) +: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=HWiNFO +set L_ITEM=HWiNFO.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 -call "%bin%\Scripts\Launch.cmd" Program "%bin%\HWiNFO" "HWiNFO.exe" "" +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Diagnostics/HitmanPro.cmd b/Diagnostics/HitmanPro.cmd index 2d20f9f9..fc85c7a2 100644 --- a/Diagnostics/HitmanPro.cmd +++ b/Diagnostics/HitmanPro.cmd @@ -1,35 +1,112 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - -:CreateInfoDir -rem Create %client_dir%\Info\YYYY-MM-DD and set path as %log_dir% +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin call "%bin%\Scripts\init_client_dir.cmd" /Info +: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=HitmanPro +set L_ITEM=HitmanPro.exe +set L_ARGS=/scan /noinstall /noupload /log=%log_dir%\hitman.xml +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 -call "%bin%\Scripts\Launch.cmd" Program "%bin%\HitmanPro" "HitmanPro.exe" "/scan /noinstall /noupload /log=%log_dir%\hitman.xml" /admin +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Diagnostics/ProduKey.cmd b/Diagnostics/ProduKey.cmd index e61fbbfa..359887d7 100644 --- a/Diagnostics/ProduKey.cmd +++ b/Diagnostics/ProduKey.cmd @@ -1,50 +1,117 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - :Init -setlocal EnableDelayedExpansion +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin :ClearConfigs -if not exist "%bin%\tmp" goto Extract -pushd "%bin%\tmp" -if exist "ProduKey.cfg" del "ProduKey.cfg" -if exist "ProduKey64.cfg" del "ProduKey64.cfg" -popd +if exist "%bin%\ProduKey" ( + del "%bin%\ProduKey\ProduKey.cfg" 2>nul + del "%bin%\ProduKey\ProduKey64.cfg" 2>nul +) -:Extract -cls -mkdir "%bin%\tmp" >nul 2>&1 -call "%bin%\Scripts\Launch.cmd" Program "%bin%" "%bin%\7-Zip\7za.exe" "e ProduKey.7z -otmp -aoa -pAbracadabra -bsp0 -bso0" /wait -ping -n 2 127.0.0.1>nul +: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=ProduKey +set L_ITEM=ProduKey.exe +set L_ARGS= +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 -call "%bin%\Scripts\Launch.cmd" Program "%bin%\tmp" "ProduKey.exe" "" /admin - -:Done -endlocal +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Diagnostics/SIV.cmd b/Diagnostics/SIV.cmd index c21c8393..ef4027b4 100644 --- a/Diagnostics/SIV.cmd +++ b/Diagnostics/SIV.cmd @@ -1,31 +1,111 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +: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=SIV +set L_ITEM=SIV.exe +set L_ARGS=-LOCAL -KEYS -UNICODE -NOWIZARD +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 -call "%bin%\Scripts\Launch.cmd" Program "%bin%\SIV" "SIV.exe" "-LOCAL -KEYS -UNICODE -NOWIZARD" +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Drivers/AMD.url b/Drivers/AMD.url new file mode 100644 index 00000000..7dec6ac4 --- /dev/null +++ b/Drivers/AMD.url @@ -0,0 +1,2 @@ +[InternetShortcut] +URL=https://support.amd.com/en-us/download diff --git a/Drivers/Acer.cmd b/Drivers/Acer.cmd new file mode 100644 index 00000000..9168025a --- /dev/null +++ b/Drivers/Acer.cmd @@ -0,0 +1,122 @@ +:: 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 + +:Configure +rem just configure for both x32 & x64 +for %%a in (32 64) do ( + copy /y "%bin%\HWiNFO\general.ini" "%bin%\HWiNFO\HWiNFO%%a.ini" + (echo SensorsOnly=0)>>"%bin%\HWiNFO\HWiNFO%%a.ini" + (echo SummaryOnly=0)>>"%bin%\HWiNFO\HWiNFO%%a.ini" +) + +:OpenDriverPage +start "" "http://us.acer.com/ac/en/US/content/drivers" + +: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=HWiNFO +set L_ITEM=HWiNFO.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% \ No newline at end of file diff --git a/Drivers/Auto Detect - Acer.cmd b/Drivers/Auto Detect - Acer.cmd deleted file mode 100644 index 745c9077..00000000 --- a/Drivers/Auto Detect - Acer.cmd +++ /dev/null @@ -1,33 +0,0 @@ -@echo off - -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - -:Launch -echo Waiting for software installation to finish... -call "%bin%\Scripts\Launch.cmd" Program "%bin%\_Drivers" "Acer Serial Number Detect Tool.exe" "" /admin /wait -start "" "http://us.acer.com/ac/en/US/content/drivers" -goto Exit - -:ErrorNoBin -popd -color 4e -echo ".bin" folder not found, aborting script. -echo. -echo Press any key to exit... -pause>nul -color -goto Exit - -:Exit diff --git a/Drivers/Auto Detect - Dell.cmd b/Drivers/Auto Detect - Dell.cmd deleted file mode 100644 index 23f6615d..00000000 --- a/Drivers/Auto Detect - Dell.cmd +++ /dev/null @@ -1,33 +0,0 @@ -@echo off - -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - -:Launch -echo Waiting for software installation to finish... -call "%bin%\Scripts\Launch.cmd" Program "%bin%\_Drivers" "Dell System Detect.exe" "" /admin /wait -start "" "http://www.dell.com/support/home/us/en/19/Eula/scan?sourcePage=J&scanType=TMC&loadSection=N&AppName=drivers&app=drivers" -goto Exit - -:ErrorNoBin -popd -color 4e -echo ".bin" folder not found, aborting script. -echo. -echo Press any key to exit... -pause>nul -color -goto Exit - -:Exit diff --git a/Drivers/Auto Detect - HP.cmd b/Drivers/Auto Detect - HP.cmd deleted file mode 100644 index bf3a5315..00000000 --- a/Drivers/Auto Detect - HP.cmd +++ /dev/null @@ -1,33 +0,0 @@ -@echo off - -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - -:Launch -echo Waiting for software installation to finish... -call "%bin%\Scripts\Launch.cmd" Program "%bin%\_Drivers" "HP Support Solutions Framework.exe" "" /admin /wait -start "" "http://support.hp.com/us-en/drivers/selfservice/identify" -goto Exit - -:ErrorNoBin -popd -color 4e -echo ".bin" folder not found, aborting script. -echo. -echo Press any key to exit... -pause>nul -color -goto Exit - -:Exit diff --git a/Drivers/Auto Detect - Intel.cmd b/Drivers/Auto Detect - Intel.cmd deleted file mode 100644 index 1339c168..00000000 --- a/Drivers/Auto Detect - Intel.cmd +++ /dev/null @@ -1,31 +0,0 @@ -@echo off - -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - -:Launch -call "%bin%\Scripts\Launch.cmd" Program "%bin%\_Drivers" "Intel Driver Update Utility.exe" "" -goto Exit - -:ErrorNoBin -popd -color 4e -echo ".bin" folder not found, aborting script. -echo. -echo Press any key to exit... -pause>nul -color -goto Exit - -:Exit diff --git a/Drivers/Auto Detect - Lenovo.cmd b/Drivers/Auto Detect - Lenovo.cmd deleted file mode 100644 index 3192c004..00000000 --- a/Drivers/Auto Detect - Lenovo.cmd +++ /dev/null @@ -1,33 +0,0 @@ -@echo off - -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - -:Launch -echo Waiting for software installation to finish... -call "%bin%\Scripts\Launch.cmd" Program "%bin%\_Drivers" "Lenovo Service Bridge.exe" "" /admin /wait -start "" "http://support.lenovo.com/us/en/products?tabName=Downloads" -goto Exit - -:ErrorNoBin -popd -color 4e -echo ".bin" folder not found, aborting script. -echo. -echo Press any key to exit... -pause>nul -color -goto Exit - -:Exit diff --git a/Drivers/Auto Detect - SDI.cmd b/Drivers/Auto Detect - SDI.cmd deleted file mode 100644 index e99cce36..00000000 --- a/Drivers/Auto Detect - SDI.cmd +++ /dev/null @@ -1,31 +0,0 @@ -@echo off - -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - -:Launch -call "%bin%\Scripts\Launch.cmd" Program "%bin%\_Drivers\SDI" "SDI.exe" "" -goto Exit - -:ErrorNoBin -popd -color 4e -echo ".bin" folder not found, aborting script. -echo. -echo Press any key to exit... -pause>nul -color -goto Exit - -:Exit diff --git a/Drivers/Auto Detect - Toshiba.cmd b/Drivers/Auto Detect - Toshiba.cmd deleted file mode 100644 index b75a030d..00000000 --- a/Drivers/Auto Detect - Toshiba.cmd +++ /dev/null @@ -1,33 +0,0 @@ -@echo off - -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - -:Launch -echo Waiting for software installation to finish... -call "%bin%\Scripts\Launch.cmd" Program "%bin%\_Drivers" "Toshiba System Detect.exe" "" /admin /wait -start "" "http://support.toshiba.com/drivers" -goto Exit - -:ErrorNoBin -popd -color 4e -echo ".bin" folder not found, aborting script. -echo. -echo Press any key to exit... -pause>nul -color -goto Exit - -:Exit diff --git a/Drivers/Dell (FTP - Browse for Drivers).url b/Drivers/Dell (FTP - Browse for Drivers).url new file mode 100644 index 00000000..6ebda3cc --- /dev/null +++ b/Drivers/Dell (FTP - Browse for Drivers).url @@ -0,0 +1,2 @@ +[InternetShortcut] +URL=https://ftp.dell.com/browse_for_drivers/ diff --git a/Drivers/Dell (Simplified Interface).url b/Drivers/Dell (Simplified Interface).url new file mode 100644 index 00000000..175c0448 --- /dev/null +++ b/Drivers/Dell (Simplified Interface).url @@ -0,0 +1,2 @@ +[InternetShortcut] +URL=https://downloads.dell.com/published/Pages/index.html diff --git a/Drivers/Dell (Support Site).url b/Drivers/Dell (Support Site).url new file mode 100644 index 00000000..25e6aa00 --- /dev/null +++ b/Drivers/Dell (Support Site).url @@ -0,0 +1,6 @@ +[InternetShortcut] +URL=http://support.dell.com/ +IDList= +HotKey=0 +[{000214A0-0000-0000-C000-000000000046}] +Prop3=19,2 diff --git a/Drivers/Extras/DeviceRemover.cmd b/Drivers/Extras/DeviceRemover.cmd new file mode 100644 index 00000000..aa78d852 --- /dev/null +++ b/Drivers/Extras/DeviceRemover.cmd @@ -0,0 +1,111 @@ +:: 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=DeviceRemover.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% \ No newline at end of file diff --git a/Drivers/Extras/SanDisk ExpressCache (Deprecated).cmd b/Drivers/Extras/SanDisk ExpressCache (Deprecated).cmd new file mode 100644 index 00000000..3faf56f8 --- /dev/null +++ b/Drivers/Extras/SanDisk ExpressCache (Deprecated).cmd @@ -0,0 +1,111 @@ +:: 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=SanDisk Express Cache.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% \ No newline at end of file diff --git a/Drivers/GPU - AMD.cmd b/Drivers/GPU - AMD.cmd deleted file mode 100644 index c54564dc..00000000 --- a/Drivers/GPU - AMD.cmd +++ /dev/null @@ -1,31 +0,0 @@ -@echo off - -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - -:Launch -call "%bin%\Scripts\Launch.cmd" Program "%bin%\_Drivers" "AMD Autodetect.exe" "" -goto Exit - -:ErrorNoBin -popd -color 4e -echo ".bin" folder not found, aborting script. -echo. -echo Press any key to exit... -pause>nul -color -goto Exit - -:Exit diff --git a/Drivers/GPU - NVIDIA.cmd b/Drivers/GPU - NVIDIA.cmd deleted file mode 100644 index 7a447c63..00000000 --- a/Drivers/GPU - NVIDIA.cmd +++ /dev/null @@ -1,31 +0,0 @@ -@echo off - -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - -:Launch -start "" "http://www.nvidia.com/Download/index.aspx?lang=en-us" -goto Exit - -:ErrorNoBin -popd -color 4e -echo ".bin" folder not found, aborting script. -echo. -echo Press any key to exit... -pause>nul -color -goto Exit - -:Exit diff --git a/Drivers/HP.url b/Drivers/HP.url new file mode 100644 index 00000000..f2ba81d2 --- /dev/null +++ b/Drivers/HP.url @@ -0,0 +1,2 @@ +[InternetShortcut] +URL=http://support.hp.com/us-en/drivers diff --git a/Drivers/Intel Driver Update Utility.cmd b/Drivers/Intel Driver Update Utility.cmd new file mode 100644 index 00000000..606559d7 --- /dev/null +++ b/Drivers/Intel Driver Update Utility.cmd @@ -0,0 +1,111 @@ +:: 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=Intel Driver Update Utility.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% \ No newline at end of file diff --git a/Drivers/Intel RST (Current Release).cmd b/Drivers/Intel RST (Current Release).cmd new file mode 100644 index 00000000..e5b57b3a --- /dev/null +++ b/Drivers/Intel RST (Current Release).cmd @@ -0,0 +1,111 @@ +:: 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\Intel RST +set L_ITEM=SetupRST_15.2.exe +set L_ARGS= +set L_7ZIP=SetupRST_15.2.exe +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% \ No newline at end of file diff --git a/Drivers/Intel RST (Previous Releases).cmd b/Drivers/Intel RST (Previous Releases).cmd new file mode 100644 index 00000000..a9b868ae --- /dev/null +++ b/Drivers/Intel RST (Previous Releases).cmd @@ -0,0 +1,111 @@ +:: 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=Folder +set L_PATH=_Drivers\Intel RST +set L_ITEM=. +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% \ No newline at end of file diff --git a/Drivers/Intel SSD Toolbox.cmd b/Drivers/Intel SSD Toolbox.cmd new file mode 100644 index 00000000..67c4d307 --- /dev/null +++ b/Drivers/Intel SSD Toolbox.cmd @@ -0,0 +1,111 @@ +:: 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=Intel SSD Toolbox.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% \ No newline at end of file diff --git a/Drivers/Lenovo.cmd b/Drivers/Lenovo.cmd new file mode 100644 index 00000000..0cb2ff1d --- /dev/null +++ b/Drivers/Lenovo.cmd @@ -0,0 +1,122 @@ +:: 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 + +:Configure +rem just configure for both x32 & x64 +for %%a in (32 64) do ( + copy /y "%bin%\HWiNFO\general.ini" "%bin%\HWiNFO\HWiNFO%%a.ini" + (echo SensorsOnly=0)>>"%bin%\HWiNFO\HWiNFO%%a.ini" + (echo SummaryOnly=0)>>"%bin%\HWiNFO\HWiNFO%%a.ini" +) + +:OpenDriverPage +start "" "http://support.lenovo.com/us/en/products?tabName=Downloads" + +: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=HWiNFO +set L_ITEM=HWiNFO.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% \ No newline at end of file diff --git a/Drivers/NVIDIA.url b/Drivers/NVIDIA.url new file mode 100644 index 00000000..81ded381 --- /dev/null +++ b/Drivers/NVIDIA.url @@ -0,0 +1,2 @@ +[InternetShortcut] +URL=https://www.nvidia.com/Download/index.aspx?lang=en-us diff --git a/Drivers/SSD - ExpressCache.cmd b/Drivers/SSD - ExpressCache.cmd deleted file mode 100644 index 2b25b405..00000000 --- a/Drivers/SSD - ExpressCache.cmd +++ /dev/null @@ -1,31 +0,0 @@ -@echo off - -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - -:Launch -call "%bin%\Scripts\Launch.cmd" Program "%bin%\_Drivers" "SanDisk Express Cache.exe" "" -goto Exit - -:ErrorNoBin -popd -color 4e -echo ".bin" folder not found, aborting script. -echo. -echo Press any key to exit... -pause>nul -color -goto Exit - -:Exit diff --git a/Drivers/SSD - Intel.cmd b/Drivers/SSD - Intel.cmd deleted file mode 100644 index 5a93cb0e..00000000 --- a/Drivers/SSD - Intel.cmd +++ /dev/null @@ -1,31 +0,0 @@ -@echo off - -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - -:Launch -call "%bin%\Scripts\Launch.cmd" Program "%bin%\_Drivers" "Intel SSD Toolbox.exe" "" -goto Exit - -:ErrorNoBin -popd -color 4e -echo ".bin" folder not found, aborting script. -echo. -echo Press any key to exit... -pause>nul -color -goto Exit - -:Exit diff --git a/Drivers/SSD - Samsung.cmd b/Drivers/SSD - Samsung.cmd deleted file mode 100644 index 4c7c9e75..00000000 --- a/Drivers/SSD - Samsung.cmd +++ /dev/null @@ -1,31 +0,0 @@ -@echo off - -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - -:Launch -call "%bin%\Scripts\Launch.cmd" Program "%bin%\_Drivers" "Samsung Magician.exe" "" -goto Exit - -:ErrorNoBin -popd -color 4e -echo ".bin" folder not found, aborting script. -echo. -echo Press any key to exit... -pause>nul -color -goto Exit - -:Exit diff --git a/Drivers/Samsing Magician.cmd b/Drivers/Samsing Magician.cmd new file mode 100644 index 00000000..5770bcf0 --- /dev/null +++ b/Drivers/Samsing Magician.cmd @@ -0,0 +1,111 @@ +:: 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 Magician.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% \ No newline at end of file diff --git a/Drivers/Snappy Driver Installer.cmd b/Drivers/Snappy Driver Installer.cmd new file mode 100644 index 00000000..9a0a0907 --- /dev/null +++ b/Drivers/Snappy Driver Installer.cmd @@ -0,0 +1,111 @@ +:: 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\SDI +set L_ITEM=SDI.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% \ No newline at end of file diff --git a/Drivers/Toshiba.cmd b/Drivers/Toshiba.cmd new file mode 100644 index 00000000..b958fd40 --- /dev/null +++ b/Drivers/Toshiba.cmd @@ -0,0 +1,122 @@ +:: 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 + +:Configure +rem just configure for both x32 & x64 +for %%a in (32 64) do ( + copy /y "%bin%\HWiNFO\general.ini" "%bin%\HWiNFO\HWiNFO%%a.ini" + (echo SensorsOnly=0)>>"%bin%\HWiNFO\HWiNFO%%a.ini" + (echo SummaryOnly=0)>>"%bin%\HWiNFO\HWiNFO%%a.ini" +) + +:OpenDriverPage +start "" "http://support.toshiba.com/drivers" + +: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=HWiNFO +set L_ITEM=HWiNFO.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% \ No newline at end of file diff --git a/Enter SafeMode.cmd b/Enter SafeMode.cmd index 1c4885ba..03792946 100644 --- a/Enter SafeMode.cmd +++ b/Enter SafeMode.cmd @@ -1,31 +1,111 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +: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=PyScript +set L_PATH=Scripts +set L_ITEM=safemode_enter.py +set L_ARGS= +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 -call "%bin%\Scripts\Launch.cmd" PSScript "%bin%\Scripts" "enter_safemode.ps1" /admin +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Exit SafeMode.cmd b/Exit SafeMode.cmd index 2b5429e2..f9157478 100644 --- a/Exit SafeMode.cmd +++ b/Exit SafeMode.cmd @@ -1,31 +1,111 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +: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=PyScript +set L_PATH=Scripts +set L_ITEM=safemode_exit.py +set L_ARGS= +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 -call "%bin%\Scripts\Launch.cmd" PSScript "%bin%\Scripts" "exit_safemode.ps1" /admin +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Final Checklist.cmd b/Final Checklist.cmd deleted file mode 100644 index f4191c65..00000000 --- a/Final Checklist.cmd +++ /dev/null @@ -1,31 +0,0 @@ -@echo off - -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - -:Launch -call "%bin%\Scripts\Launch.cmd" PSScript "%bin%\Scripts" "final_checklist.ps1" /admin -goto Exit - -:ErrorNoBin -popd -color 4e -echo ".bin" folder not found, aborting script. -echo. -echo Press any key to exit... -pause>nul -color -goto Exit - -:Exit diff --git a/Installers/Extras/Office/2007/2007 Microsoft Office system (SP3).cmd b/Installers/Extras/Office/2007/2007 Microsoft Office system (SP3).cmd index c55c8be5..3db0768c 100644 --- a/Installers/Extras/Office/2007/2007 Microsoft Office system (SP3).cmd +++ b/Installers/Extras/Office/2007/2007 Microsoft Office system (SP3).cmd @@ -1,32 +1,110 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +:DefineLaunch +:: Set L_TYPE to one of these options: +:: Console +:: Office +:: Program +:: PSScript +:: PyScript +:: Set L_PATH to the path to the program folder +:: NOTE: Launch.cmd will test for L_PATH in the following order: +:: 1: %bin%\L_PATH +:: 2: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) +:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) +:: Set L_ITEM to the filename of the item to launch (or Office product to install) +:: Set L_ARGS to include any necessary arguments (if any) +:: 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=Office +set L_PATH=2007 +set L_ITEM=2007 Microsoft Office system (SP3) +set L_ARGS= +set L_CHCK=True +set L_ELEV= +set L_NCMD= +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 -call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2007\2007 Microsoft Office system (SP3)" - +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Installers/Extras/Office/2007/Access 2007 (SP3).cmd b/Installers/Extras/Office/2007/Access 2007 (SP3).cmd index 85474c41..8eca620d 100644 --- a/Installers/Extras/Office/2007/Access 2007 (SP3).cmd +++ b/Installers/Extras/Office/2007/Access 2007 (SP3).cmd @@ -1,32 +1,110 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +:DefineLaunch +:: Set L_TYPE to one of these options: +:: Console +:: Office +:: Program +:: PSScript +:: PyScript +:: Set L_PATH to the path to the program folder +:: NOTE: Launch.cmd will test for L_PATH in the following order: +:: 1: %bin%\L_PATH +:: 2: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) +:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) +:: Set L_ITEM to the filename of the item to launch (or Office product to install) +:: Set L_ARGS to include any necessary arguments (if any) +:: 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=Office +set L_PATH=2007 +set L_ITEM=Access 2007 (SP3) +set L_ARGS= +set L_CHCK=True +set L_ELEV= +set L_NCMD= +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 -call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2007\Access 2007 (SP3)" - +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Installers/Extras/Office/2007/AccessRuntime2007.cmd b/Installers/Extras/Office/2007/AccessRuntime2007.cmd index e5d3c8a0..2311671a 100644 --- a/Installers/Extras/Office/2007/AccessRuntime2007.cmd +++ b/Installers/Extras/Office/2007/AccessRuntime2007.cmd @@ -1,32 +1,110 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +:DefineLaunch +:: Set L_TYPE to one of these options: +:: Console +:: Office +:: Program +:: PSScript +:: PyScript +:: Set L_PATH to the path to the program folder +:: NOTE: Launch.cmd will test for L_PATH in the following order: +:: 1: %bin%\L_PATH +:: 2: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) +:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) +:: Set L_ITEM to the filename of the item to launch (or Office product to install) +:: Set L_ARGS to include any necessary arguments (if any) +:: 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=Office +set L_PATH=2007 +set L_ITEM=AccessRuntime2007.exe +set L_ARGS= +set L_CHCK=True +set L_ELEV= +set L_NCMD= +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 -call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2007\AccessRuntime2007.exe" - +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Installers/Extras/Office/2007/Home and Student 2007 (SP3).cmd b/Installers/Extras/Office/2007/Home and Student 2007 (SP3).cmd index 314579ee..4d604f2a 100644 --- a/Installers/Extras/Office/2007/Home and Student 2007 (SP3).cmd +++ b/Installers/Extras/Office/2007/Home and Student 2007 (SP3).cmd @@ -1,32 +1,110 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +:DefineLaunch +:: Set L_TYPE to one of these options: +:: Console +:: Office +:: Program +:: PSScript +:: PyScript +:: Set L_PATH to the path to the program folder +:: NOTE: Launch.cmd will test for L_PATH in the following order: +:: 1: %bin%\L_PATH +:: 2: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) +:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) +:: Set L_ITEM to the filename of the item to launch (or Office product to install) +:: Set L_ARGS to include any necessary arguments (if any) +:: 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=Office +set L_PATH=2007 +set L_ITEM=Home and Student 2007 (SP3) +set L_ARGS= +set L_CHCK=True +set L_ELEV= +set L_NCMD= +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 -call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2007\Home and Student 2007 (SP3)" - +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Installers/Extras/Office/2007/Outlook 2007 (SP3).cmd b/Installers/Extras/Office/2007/Outlook 2007 (SP3).cmd index 4a37c3c4..c86a1ea2 100644 --- a/Installers/Extras/Office/2007/Outlook 2007 (SP3).cmd +++ b/Installers/Extras/Office/2007/Outlook 2007 (SP3).cmd @@ -1,32 +1,110 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +:DefineLaunch +:: Set L_TYPE to one of these options: +:: Console +:: Office +:: Program +:: PSScript +:: PyScript +:: Set L_PATH to the path to the program folder +:: NOTE: Launch.cmd will test for L_PATH in the following order: +:: 1: %bin%\L_PATH +:: 2: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) +:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) +:: Set L_ITEM to the filename of the item to launch (or Office product to install) +:: Set L_ARGS to include any necessary arguments (if any) +:: 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=Office +set L_PATH=2007 +set L_ITEM=Outlook 2007 (SP3) +set L_ARGS= +set L_CHCK=True +set L_ELEV= +set L_NCMD= +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 -call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2007\Outlook 2007 (SP3)" - +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Installers/Extras/Office/2007/Professional 2007 (SP3).cmd b/Installers/Extras/Office/2007/Professional 2007 (SP3).cmd index b92ceec5..ca8ef010 100644 --- a/Installers/Extras/Office/2007/Professional 2007 (SP3).cmd +++ b/Installers/Extras/Office/2007/Professional 2007 (SP3).cmd @@ -1,32 +1,110 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +:DefineLaunch +:: Set L_TYPE to one of these options: +:: Console +:: Office +:: Program +:: PSScript +:: PyScript +:: Set L_PATH to the path to the program folder +:: NOTE: Launch.cmd will test for L_PATH in the following order: +:: 1: %bin%\L_PATH +:: 2: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) +:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) +:: Set L_ITEM to the filename of the item to launch (or Office product to install) +:: Set L_ARGS to include any necessary arguments (if any) +:: 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=Office +set L_PATH=2007 +set L_ITEM=Professional 2007 (SP3) +set L_ARGS= +set L_CHCK=True +set L_ELEV= +set L_NCMD= +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 -call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2007\Professional 2007 (SP3)" - +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Installers/Extras/Office/2007/Publisher 2007 (SP3).cmd b/Installers/Extras/Office/2007/Publisher 2007 (SP3).cmd index fa7c0d8f..dd7a4e8e 100644 --- a/Installers/Extras/Office/2007/Publisher 2007 (SP3).cmd +++ b/Installers/Extras/Office/2007/Publisher 2007 (SP3).cmd @@ -1,32 +1,110 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +:DefineLaunch +:: Set L_TYPE to one of these options: +:: Console +:: Office +:: Program +:: PSScript +:: PyScript +:: Set L_PATH to the path to the program folder +:: NOTE: Launch.cmd will test for L_PATH in the following order: +:: 1: %bin%\L_PATH +:: 2: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) +:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) +:: Set L_ITEM to the filename of the item to launch (or Office product to install) +:: Set L_ARGS to include any necessary arguments (if any) +:: 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=Office +set L_PATH=2007 +set L_ITEM=Publisher 2007 (SP3) +set L_ARGS= +set L_CHCK=True +set L_ELEV= +set L_NCMD= +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 -call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2007\Publisher 2007 (SP3)" - +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Installers/Extras/Office/2007/Small Business 2007 (SP3).cmd b/Installers/Extras/Office/2007/Small Business 2007 (SP3).cmd index 994eb95a..579efd4b 100644 --- a/Installers/Extras/Office/2007/Small Business 2007 (SP3).cmd +++ b/Installers/Extras/Office/2007/Small Business 2007 (SP3).cmd @@ -1,32 +1,110 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +:DefineLaunch +:: Set L_TYPE to one of these options: +:: Console +:: Office +:: Program +:: PSScript +:: PyScript +:: Set L_PATH to the path to the program folder +:: NOTE: Launch.cmd will test for L_PATH in the following order: +:: 1: %bin%\L_PATH +:: 2: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) +:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) +:: Set L_ITEM to the filename of the item to launch (or Office product to install) +:: Set L_ARGS to include any necessary arguments (if any) +:: 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=Office +set L_PATH=2007 +set L_ITEM=Small Business 2007 (SP3) +set L_ARGS= +set L_CHCK=True +set L_ELEV= +set L_NCMD= +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 -call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2007\Small Business 2007 (SP3)" - +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Installers/Extras/Office/2010/Outlook 2010 (SP2) (x32).cmd b/Installers/Extras/Office/2010/Outlook 2010 (SP2) (x32).cmd index 00eec8da..ae66c179 100644 --- a/Installers/Extras/Office/2010/Outlook 2010 (SP2) (x32).cmd +++ b/Installers/Extras/Office/2010/Outlook 2010 (SP2) (x32).cmd @@ -1,32 +1,110 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +:DefineLaunch +:: Set L_TYPE to one of these options: +:: Console +:: Office +:: Program +:: PSScript +:: PyScript +:: Set L_PATH to the path to the program folder +:: NOTE: Launch.cmd will test for L_PATH in the following order: +:: 1: %bin%\L_PATH +:: 2: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) +:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) +:: Set L_ITEM to the filename of the item to launch (or Office product to install) +:: Set L_ARGS to include any necessary arguments (if any) +:: 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=Office +set L_PATH=2010 +set L_ITEM=Outlook 2010 (SP2) (x32) +set L_ARGS= +set L_CHCK=True +set L_ELEV= +set L_NCMD= +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 -call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2010\Outlook 2010 (SP2) (x32)" - +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Installers/Extras/Office/2010/Outlook 2010 (SP2) (x64).cmd b/Installers/Extras/Office/2010/Outlook 2010 (SP2) (x64).cmd index 2367166f..a27149e5 100644 --- a/Installers/Extras/Office/2010/Outlook 2010 (SP2) (x64).cmd +++ b/Installers/Extras/Office/2010/Outlook 2010 (SP2) (x64).cmd @@ -1,32 +1,110 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +:DefineLaunch +:: Set L_TYPE to one of these options: +:: Console +:: Office +:: Program +:: PSScript +:: PyScript +:: Set L_PATH to the path to the program folder +:: NOTE: Launch.cmd will test for L_PATH in the following order: +:: 1: %bin%\L_PATH +:: 2: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) +:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) +:: Set L_ITEM to the filename of the item to launch (or Office product to install) +:: Set L_ARGS to include any necessary arguments (if any) +:: 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=Office +set L_PATH=2010 +set L_ITEM=Outlook 2010 (SP2) (x64) +set L_ARGS= +set L_CHCK=True +set L_ELEV= +set L_NCMD= +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 -call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2010\Outlook 2010 (SP2) (x64)" - +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Installers/Extras/Office/2010/Professional Plus 2010 (SP2).cmd b/Installers/Extras/Office/2010/Professional Plus 2010 (SP2).cmd index f5c69563..8649e3a8 100644 --- a/Installers/Extras/Office/2010/Professional Plus 2010 (SP2).cmd +++ b/Installers/Extras/Office/2010/Professional Plus 2010 (SP2).cmd @@ -1,32 +1,110 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +:DefineLaunch +:: Set L_TYPE to one of these options: +:: Console +:: Office +:: Program +:: PSScript +:: PyScript +:: Set L_PATH to the path to the program folder +:: NOTE: Launch.cmd will test for L_PATH in the following order: +:: 1: %bin%\L_PATH +:: 2: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) +:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) +:: Set L_ITEM to the filename of the item to launch (or Office product to install) +:: Set L_ARGS to include any necessary arguments (if any) +:: 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=Office +set L_PATH=2010 +set L_ITEM=Professional Plus 2010 (SP2) +set L_ARGS= +set L_CHCK=True +set L_ELEV= +set L_NCMD= +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 -call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2010\Professional Plus 2010 (SP2)" - +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Installers/Extras/Office/2010/Publisher 2010 (SP2).cmd b/Installers/Extras/Office/2010/Publisher 2010 (SP2).cmd index 20c21467..a2925608 100644 --- a/Installers/Extras/Office/2010/Publisher 2010 (SP2).cmd +++ b/Installers/Extras/Office/2010/Publisher 2010 (SP2).cmd @@ -1,32 +1,110 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +:DefineLaunch +:: Set L_TYPE to one of these options: +:: Console +:: Office +:: Program +:: PSScript +:: PyScript +:: Set L_PATH to the path to the program folder +:: NOTE: Launch.cmd will test for L_PATH in the following order: +:: 1: %bin%\L_PATH +:: 2: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) +:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) +:: Set L_ITEM to the filename of the item to launch (or Office product to install) +:: Set L_ARGS to include any necessary arguments (if any) +:: 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=Office +set L_PATH=2010 +set L_ITEM=Publisher 2010 (SP2) +set L_ARGS= +set L_CHCK=True +set L_ELEV= +set L_NCMD= +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 -call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2010\Publisher 2010 (SP2)" - +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Installers/Extras/Office/2010/Single Image 2010 (SP2).cmd b/Installers/Extras/Office/2010/Single Image 2010 (SP2).cmd index 2017c15c..e8c3b017 100644 --- a/Installers/Extras/Office/2010/Single Image 2010 (SP2).cmd +++ b/Installers/Extras/Office/2010/Single Image 2010 (SP2).cmd @@ -1,32 +1,110 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +:DefineLaunch +:: Set L_TYPE to one of these options: +:: Console +:: Office +:: Program +:: PSScript +:: PyScript +:: Set L_PATH to the path to the program folder +:: NOTE: Launch.cmd will test for L_PATH in the following order: +:: 1: %bin%\L_PATH +:: 2: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) +:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) +:: Set L_ITEM to the filename of the item to launch (or Office product to install) +:: Set L_ARGS to include any necessary arguments (if any) +:: 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=Office +set L_PATH=2010 +set L_ITEM=Single Image 2010 (SP2) +set L_ARGS= +set L_CHCK=True +set L_ELEV= +set L_NCMD= +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 -call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2010\Single Image 2010 (SP2)" - +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Installers/Extras/Office/2013/Home and Business 2013 (x32).cmd b/Installers/Extras/Office/2013/Home and Business 2013 (x32).cmd new file mode 100644 index 00000000..a0542d0e --- /dev/null +++ b/Installers/Extras/Office/2013/Home and Business 2013 (x32).cmd @@ -0,0 +1,110 @@ +:: 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 +:: Office +:: Program +:: PSScript +:: PyScript +:: Set L_PATH to the path to the program folder +:: NOTE: Launch.cmd will test for L_PATH in the following order: +:: 1: %bin%\L_PATH +:: 2: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) +:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) +:: Set L_ITEM to the filename of the item to launch (or Office product to install) +:: Set L_ARGS to include any necessary arguments (if any) +:: 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=Office +set L_PATH=2013 +set L_ITEM=hb_32.xml +set L_ARGS= +set L_CHCK=True +set L_ELEV= +set L_NCMD= +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% \ No newline at end of file diff --git a/Installers/Extras/Office/2013/Home and Business 2013 (x64).cmd b/Installers/Extras/Office/2013/Home and Business 2013 (x64).cmd new file mode 100644 index 00000000..e88aff55 --- /dev/null +++ b/Installers/Extras/Office/2013/Home and Business 2013 (x64).cmd @@ -0,0 +1,110 @@ +:: 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 +:: Office +:: Program +:: PSScript +:: PyScript +:: Set L_PATH to the path to the program folder +:: NOTE: Launch.cmd will test for L_PATH in the following order: +:: 1: %bin%\L_PATH +:: 2: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) +:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) +:: Set L_ITEM to the filename of the item to launch (or Office product to install) +:: Set L_ARGS to include any necessary arguments (if any) +:: 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=Office +set L_PATH=2013 +set L_ITEM=hb_64.xml +set L_ARGS= +set L_CHCK=True +set L_ELEV= +set L_NCMD= +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% \ No newline at end of file diff --git a/Installers/Extras/Office/2013/Home and Business 2013.cmd b/Installers/Extras/Office/2013/Home and Business 2013.cmd deleted file mode 100644 index 336ccd0a..00000000 --- a/Installers/Extras/Office/2013/Home and Business 2013.cmd +++ /dev/null @@ -1,32 +0,0 @@ -@echo off - -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - -:Launch -call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2013\Home and Business 2013" - -goto Exit - -:ErrorNoBin -popd -color 4e -echo ".bin" folder not found, aborting script. -echo. -echo Press any key to exit... -pause>nul -color -goto Exit - -:Exit diff --git a/Installers/Extras/Office/2013/Home and Student 2013 (x32).cmd b/Installers/Extras/Office/2013/Home and Student 2013 (x32).cmd new file mode 100644 index 00000000..34059b71 --- /dev/null +++ b/Installers/Extras/Office/2013/Home and Student 2013 (x32).cmd @@ -0,0 +1,110 @@ +:: 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 +:: Office +:: Program +:: PSScript +:: PyScript +:: Set L_PATH to the path to the program folder +:: NOTE: Launch.cmd will test for L_PATH in the following order: +:: 1: %bin%\L_PATH +:: 2: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) +:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) +:: Set L_ITEM to the filename of the item to launch (or Office product to install) +:: Set L_ARGS to include any necessary arguments (if any) +:: 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=Office +set L_PATH=2013 +set L_ITEM=hs_32.xml +set L_ARGS= +set L_CHCK=True +set L_ELEV= +set L_NCMD= +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% \ No newline at end of file diff --git a/Installers/Extras/Office/2013/Home and Student 2013 (x64).cmd b/Installers/Extras/Office/2013/Home and Student 2013 (x64).cmd new file mode 100644 index 00000000..a2da52da --- /dev/null +++ b/Installers/Extras/Office/2013/Home and Student 2013 (x64).cmd @@ -0,0 +1,110 @@ +:: 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 +:: Office +:: Program +:: PSScript +:: PyScript +:: Set L_PATH to the path to the program folder +:: NOTE: Launch.cmd will test for L_PATH in the following order: +:: 1: %bin%\L_PATH +:: 2: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) +:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) +:: Set L_ITEM to the filename of the item to launch (or Office product to install) +:: Set L_ARGS to include any necessary arguments (if any) +:: 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=Office +set L_PATH=2013 +set L_ITEM=hs_64.xml +set L_ARGS= +set L_CHCK=True +set L_ELEV= +set L_NCMD= +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% \ No newline at end of file diff --git a/Installers/Extras/Office/2013/Home and Student 2013.cmd b/Installers/Extras/Office/2013/Home and Student 2013.cmd deleted file mode 100644 index 3a679d3e..00000000 --- a/Installers/Extras/Office/2013/Home and Student 2013.cmd +++ /dev/null @@ -1,32 +0,0 @@ -@echo off - -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - -:Launch -call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2013\Home and Student 2013" - -goto Exit - -:ErrorNoBin -popd -color 4e -echo ".bin" folder not found, aborting script. -echo. -echo Press any key to exit... -pause>nul -color -goto Exit - -:Exit diff --git a/Installers/Extras/Office/2013/Office 365 2013 (x32).cmd b/Installers/Extras/Office/2013/Office 365 2013 (x32).cmd new file mode 100644 index 00000000..c79e51d9 --- /dev/null +++ b/Installers/Extras/Office/2013/Office 365 2013 (x32).cmd @@ -0,0 +1,110 @@ +:: 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 +:: Office +:: Program +:: PSScript +:: PyScript +:: Set L_PATH to the path to the program folder +:: NOTE: Launch.cmd will test for L_PATH in the following order: +:: 1: %bin%\L_PATH +:: 2: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) +:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) +:: Set L_ITEM to the filename of the item to launch (or Office product to install) +:: Set L_ARGS to include any necessary arguments (if any) +:: 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=Office +set L_PATH=2013 +set L_ITEM=365_32.xml +set L_ARGS= +set L_CHCK=True +set L_ELEV= +set L_NCMD= +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% \ No newline at end of file diff --git a/Installers/Extras/Office/2013/Office 365 2013 (x64).cmd b/Installers/Extras/Office/2013/Office 365 2013 (x64).cmd new file mode 100644 index 00000000..05290ec9 --- /dev/null +++ b/Installers/Extras/Office/2013/Office 365 2013 (x64).cmd @@ -0,0 +1,110 @@ +:: 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 +:: Office +:: Program +:: PSScript +:: PyScript +:: Set L_PATH to the path to the program folder +:: NOTE: Launch.cmd will test for L_PATH in the following order: +:: 1: %bin%\L_PATH +:: 2: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) +:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) +:: Set L_ITEM to the filename of the item to launch (or Office product to install) +:: Set L_ARGS to include any necessary arguments (if any) +:: 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=Office +set L_PATH=2013 +set L_ITEM=365_64.xml +set L_ARGS= +set L_CHCK=True +set L_ELEV= +set L_NCMD= +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% \ No newline at end of file diff --git a/Installers/Extras/Office/2013/Professional Plus 2013.cmd b/Installers/Extras/Office/2013/Professional Plus 2013.cmd deleted file mode 100644 index d5a14822..00000000 --- a/Installers/Extras/Office/2013/Professional Plus 2013.cmd +++ /dev/null @@ -1,32 +0,0 @@ -@echo off - -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - -:Launch -call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2013\Professional Plus 2013" - -goto Exit - -:ErrorNoBin -popd -color 4e -echo ".bin" folder not found, aborting script. -echo. -echo Press any key to exit... -pause>nul -color -goto Exit - -:Exit diff --git a/Installers/Extras/Office/2016/Home and Business 2016 (x32).cmd b/Installers/Extras/Office/2016/Home and Business 2016 (x32).cmd new file mode 100644 index 00000000..938d79a1 --- /dev/null +++ b/Installers/Extras/Office/2016/Home and Business 2016 (x32).cmd @@ -0,0 +1,110 @@ +:: 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 +:: Office +:: Program +:: PSScript +:: PyScript +:: Set L_PATH to the path to the program folder +:: NOTE: Launch.cmd will test for L_PATH in the following order: +:: 1: %bin%\L_PATH +:: 2: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) +:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) +:: Set L_ITEM to the filename of the item to launch (or Office product to install) +:: Set L_ARGS to include any necessary arguments (if any) +:: 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=Office +set L_PATH=2016 +set L_ITEM=hb_32.xml +set L_ARGS= +set L_CHCK=True +set L_ELEV= +set L_NCMD= +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% \ No newline at end of file diff --git a/Installers/Extras/Office/2016/Home and Business 2016 (x64).cmd b/Installers/Extras/Office/2016/Home and Business 2016 (x64).cmd new file mode 100644 index 00000000..ea209113 --- /dev/null +++ b/Installers/Extras/Office/2016/Home and Business 2016 (x64).cmd @@ -0,0 +1,110 @@ +:: 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 +:: Office +:: Program +:: PSScript +:: PyScript +:: Set L_PATH to the path to the program folder +:: NOTE: Launch.cmd will test for L_PATH in the following order: +:: 1: %bin%\L_PATH +:: 2: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) +:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) +:: Set L_ITEM to the filename of the item to launch (or Office product to install) +:: Set L_ARGS to include any necessary arguments (if any) +:: 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=Office +set L_PATH=2016 +set L_ITEM=hb_64.xml +set L_ARGS= +set L_CHCK=True +set L_ELEV= +set L_NCMD= +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% \ No newline at end of file diff --git a/Installers/Extras/Office/2016/Home and Business 2016.cmd b/Installers/Extras/Office/2016/Home and Business 2016.cmd deleted file mode 100644 index b78c2fdc..00000000 --- a/Installers/Extras/Office/2016/Home and Business 2016.cmd +++ /dev/null @@ -1,32 +0,0 @@ -@echo off - -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - -:Launch -call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2016\Home and Business 2016" - -goto Exit - -:ErrorNoBin -popd -color 4e -echo ".bin" folder not found, aborting script. -echo. -echo Press any key to exit... -pause>nul -color -goto Exit - -:Exit diff --git a/Installers/Extras/Office/2016/Home and Student 2016 (x32).cmd b/Installers/Extras/Office/2016/Home and Student 2016 (x32).cmd new file mode 100644 index 00000000..47fbf4e6 --- /dev/null +++ b/Installers/Extras/Office/2016/Home and Student 2016 (x32).cmd @@ -0,0 +1,110 @@ +:: 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 +:: Office +:: Program +:: PSScript +:: PyScript +:: Set L_PATH to the path to the program folder +:: NOTE: Launch.cmd will test for L_PATH in the following order: +:: 1: %bin%\L_PATH +:: 2: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) +:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) +:: Set L_ITEM to the filename of the item to launch (or Office product to install) +:: Set L_ARGS to include any necessary arguments (if any) +:: 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=Office +set L_PATH=2016 +set L_ITEM=hs_32.xml +set L_ARGS= +set L_CHCK=True +set L_ELEV= +set L_NCMD= +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% \ No newline at end of file diff --git a/Installers/Extras/Office/2016/Home and Student 2016 (x64).cmd b/Installers/Extras/Office/2016/Home and Student 2016 (x64).cmd new file mode 100644 index 00000000..59a76531 --- /dev/null +++ b/Installers/Extras/Office/2016/Home and Student 2016 (x64).cmd @@ -0,0 +1,110 @@ +:: 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 +:: Office +:: Program +:: PSScript +:: PyScript +:: Set L_PATH to the path to the program folder +:: NOTE: Launch.cmd will test for L_PATH in the following order: +:: 1: %bin%\L_PATH +:: 2: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) +:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) +:: Set L_ITEM to the filename of the item to launch (or Office product to install) +:: Set L_ARGS to include any necessary arguments (if any) +:: 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=Office +set L_PATH=2016 +set L_ITEM=hs_64.xml +set L_ARGS= +set L_CHCK=True +set L_ELEV= +set L_NCMD= +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% \ No newline at end of file diff --git a/Installers/Extras/Office/2016/Home and Student 2016.cmd b/Installers/Extras/Office/2016/Home and Student 2016.cmd deleted file mode 100644 index 29a1c8f6..00000000 --- a/Installers/Extras/Office/2016/Home and Student 2016.cmd +++ /dev/null @@ -1,32 +0,0 @@ -@echo off - -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - -:Launch -call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2016\Home and Student 2016" - -goto Exit - -:ErrorNoBin -popd -color 4e -echo ".bin" folder not found, aborting script. -echo. -echo Press any key to exit... -pause>nul -color -goto Exit - -:Exit diff --git a/Installers/Extras/Office/2016/Office 365 2016 (x32).cmd b/Installers/Extras/Office/2016/Office 365 2016 (x32).cmd new file mode 100644 index 00000000..7d5f2ad3 --- /dev/null +++ b/Installers/Extras/Office/2016/Office 365 2016 (x32).cmd @@ -0,0 +1,110 @@ +:: 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 +:: Office +:: Program +:: PSScript +:: PyScript +:: Set L_PATH to the path to the program folder +:: NOTE: Launch.cmd will test for L_PATH in the following order: +:: 1: %bin%\L_PATH +:: 2: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) +:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) +:: Set L_ITEM to the filename of the item to launch (or Office product to install) +:: Set L_ARGS to include any necessary arguments (if any) +:: 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=Office +set L_PATH=2016 +set L_ITEM=365_32.xml +set L_ARGS= +set L_CHCK=True +set L_ELEV= +set L_NCMD= +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% \ No newline at end of file diff --git a/Installers/Extras/Office/2016/Office 365 2016 (x64).cmd b/Installers/Extras/Office/2016/Office 365 2016 (x64).cmd new file mode 100644 index 00000000..37e0c425 --- /dev/null +++ b/Installers/Extras/Office/2016/Office 365 2016 (x64).cmd @@ -0,0 +1,110 @@ +:: 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 +:: Office +:: Program +:: PSScript +:: PyScript +:: Set L_PATH to the path to the program folder +:: NOTE: Launch.cmd will test for L_PATH in the following order: +:: 1: %bin%\L_PATH +:: 2: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) +:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) +:: Set L_ITEM to the filename of the item to launch (or Office product to install) +:: Set L_ARGS to include any necessary arguments (if any) +:: 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=Office +set L_PATH=2016 +set L_ITEM=365_64.xml +set L_ARGS= +set L_CHCK=True +set L_ELEV= +set L_NCMD= +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% \ No newline at end of file diff --git a/Installers/SW Bundle.cmd b/Installers/SW Bundle.cmd index ebd09227..7e5eda39 100644 --- a/Installers/SW Bundle.cmd +++ b/Installers/SW Bundle.cmd @@ -1,31 +1,111 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +: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=PyScript +set L_PATH=Scripts +set L_ITEM=install_sw_bundle.py +set L_ARGS= +set L_7ZIP= +set L_CHCK=True +set L_ELEV=True +set L_NCMD= +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 -call "%bin%\Scripts\Launch.cmd" PyScript "%bin%\Scripts" "install_sw_bundle.py" /admin +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Misc/ConEmu (as ADMIN).cmd b/Misc/ConEmu (as ADMIN).cmd index 82810040..e288c75c 100644 --- a/Misc/ConEmu (as ADMIN).cmd +++ b/Misc/ConEmu (as ADMIN).cmd @@ -1,31 +1,111 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +: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=ConEmu +set L_ITEM=ConEmu.exe +set L_ARGS= +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 -call "%bin%\Scripts\Launch.cmd" Program "%bin%\ConEmu" "ConEmu.exe" "" /admin +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Misc/ConEmu.cmd b/Misc/ConEmu.cmd index a1ad3c34..90b0cdad 100644 --- a/Misc/ConEmu.cmd +++ b/Misc/ConEmu.cmd @@ -1,31 +1,111 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +: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=ConEmu +set L_ITEM=ConEmu.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 -call "%bin%\Scripts\Launch.cmd" Program "%bin%\ConEmu" "ConEmu.exe" "" +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Misc/DeviceRemover.cmd b/Misc/DeviceRemover.cmd deleted file mode 100644 index dc4b1cc9..00000000 --- a/Misc/DeviceRemover.cmd +++ /dev/null @@ -1,31 +0,0 @@ -@echo off - -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - -:Launch -call "%bin%\Scripts\Launch.cmd" Program "%bin%" "DeviceRemover.exe" "" -goto Exit - -:ErrorNoBin -popd -color 4e -echo ".bin" folder not found, aborting script. -echo. -echo Press any key to exit... -pause>nul -color -goto Exit - -:Exit diff --git a/Misc/Everything.cmd b/Misc/Everything.cmd new file mode 100644 index 00000000..e763602e --- /dev/null +++ b/Misc/Everything.cmd @@ -0,0 +1,111 @@ +:: 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=Everything +set L_ITEM=Everything.exe +set L_ARGS=-nodb +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% \ No newline at end of file diff --git a/Misc/Explorer++.cmd b/Misc/Explorer++.cmd deleted file mode 100644 index c82029bc..00000000 --- a/Misc/Explorer++.cmd +++ /dev/null @@ -1,31 +0,0 @@ -@echo off - -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - -:Launch -call "%bin%\Scripts\Launch.cmd" Program "%bin%\Explorer++" "Explorer++.exe" "%userprofile%" /max -goto Exit - -:ErrorNoBin -popd -color 4e -echo ".bin" folder not found, aborting script. -echo. -echo Press any key to exit... -pause>nul -color -goto Exit - -:Exit diff --git a/Misc/Notepad2.cmd b/Misc/Notepad2.cmd index 2b4f9bfd..87d1e0b2 100644 --- a/Misc/Notepad2.cmd +++ b/Misc/Notepad2.cmd @@ -1,31 +1,111 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +: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=Notepad2 +set L_ITEM=Notepad2-Mod.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 -call "%bin%\Scripts\Launch.cmd" Program "%bin%\Notepad2" "Notepad2-Mod.exe" "" +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Misc/OutlookAttachView (as ADMIN).cmd b/Misc/OutlookAttachView (as ADMIN).cmd index 68ee96f5..4e6e3e7c 100644 --- a/Misc/OutlookAttachView (as ADMIN).cmd +++ b/Misc/OutlookAttachView (as ADMIN).cmd @@ -1,43 +1,111 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - :Init -setlocal enabledelayedexpansion +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:Extract -mkdir "%bin%\tmp" >nul 2>&1 -call "%bin%\Scripts\Launch.cmd" Program "%bin%" "%bin%\7-Zip\7za.exe" "x OutlookAttachView.7z -otmp -aoa -pAbracadabra -bsp0 -bso0" /wait -ping -n 2 127.0.0.1>nul +: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=OutlookAttachView +set L_ITEM=OutlookAttachView.exe +set L_ARGS= +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 -call "%bin%\Scripts\Launch.cmd" Program "%bin%\tmp" "OutlookAttachView.exe" "" /admin - -:Done -popd -endlocal +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% diff --git a/Misc/OutlookAttachView.cmd b/Misc/OutlookAttachView.cmd index e4f0af88..f86e9548 100644 --- a/Misc/OutlookAttachView.cmd +++ b/Misc/OutlookAttachView.cmd @@ -1,43 +1,111 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - :Init -setlocal enabledelayedexpansion +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:Extract -mkdir "%bin%\tmp" >nul 2>&1 -call "%bin%\Scripts\Launch.cmd" Program "%bin%" "%bin%\7-Zip\7za.exe" "x OutlookAttachView.7z -otmp -aoa -pAbracadabra -bsp0 -bso0" /wait -ping -n 2 127.0.0.1>nul +: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=OutlookAttachView +set L_ITEM=OutlookAttachView.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 -call "%bin%\Scripts\Launch.cmd" Program "%bin%\tmp" "OutlookAttachView.exe" "" - -:Done -popd -endlocal +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% diff --git a/Misc/PerfMonitor2.cmd b/Misc/PerfMonitor2.cmd index 3aa4168b..c5f0e4a6 100644 --- a/Misc/PerfMonitor2.cmd +++ b/Misc/PerfMonitor2.cmd @@ -1,31 +1,111 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +: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=PerfMonitor2 +set L_ITEM=PerfMonitor2.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 -call "%bin%\Scripts\Launch.cmd" Program "%bin%\PerfMonitor2" "PerfMonitor2.exe" "" +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Misc/Q-Dir.cmd b/Misc/Q-Dir.cmd deleted file mode 100644 index 3c4daa41..00000000 --- a/Misc/Q-Dir.cmd +++ /dev/null @@ -1,31 +0,0 @@ -@echo off - -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - -:Launch -call "%bin%\Scripts\Launch.cmd" Program "%bin%\Q-Dir" "Q-Dir.exe" "%userprofile%" /max -goto Exit - -:ErrorNoBin -popd -color 4e -echo ".bin" folder not found, aborting script. -echo. -echo Press any key to exit... -pause>nul -color -goto Exit - -:Exit diff --git a/Misc/SysinternalsSuite.cmd b/Misc/SysinternalsSuite.cmd index 49b0462f..b77da620 100644 --- a/Misc/SysinternalsSuite.cmd +++ b/Misc/SysinternalsSuite.cmd @@ -1,32 +1,111 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +: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=Folder +set L_PATH=SysinternalsSuite +set L_ITEM=. +set L_ARGS= +set L_7ZIP= +set L_CHCK=True +set L_ELEV= +set L_NCMD= +set L_WAIT= -:OpenFolder -cd /d %~dp0 -start "" "explorer.exe" "%bin%\SysinternalsSuite" +::::::::::::::::::::::::::::::::::::::::::: +:: 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 -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Misc/WinDirStat.cmd b/Misc/WinDirStat.cmd index 938f0e8d..9261acbe 100644 --- a/Misc/WinDirStat.cmd +++ b/Misc/WinDirStat.cmd @@ -1,20 +1,17 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - -:ModifySettings +:Config reg add HKCU\Software\Seifert\WinDirStat\options /v followJunctionPoints /t REG_DWORD /d 0 /f >nul reg add HKCU\Software\Seifert\WinDirStat\options /v followMountPoints /t REG_DWORD /d 0 /f >nul reg add HKCU\Software\Seifert\WinDirStat\options /v humanFormat /t REG_DWORD /d 1 /f >nul @@ -28,18 +25,101 @@ reg add HKCU\Software\Seifert\WinDirStat\options /v treemapGrid /t REG_DWORD /d reg add HKCU\Software\Seifert\WinDirStat\options /v useWdsLocale /t REG_DWORD /d 0 /f >nul reg add HKCU\Software\Seifert\WinDirStat\persistence /v showTreemap /t REG_DWORD /d 0 /f >nul +: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=WinDirStat +set L_ITEM=windirstat.exe +set L_ARGS= +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 -call "%bin%\Scripts\Launch.cmd" Program "%bin%\WinDirStat" "windirstat.exe" "" /admin /max +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Misc/XMPlay.cmd b/Misc/XMPlay.cmd index 7baefd6c..f676eac8 100644 --- a/Misc/XMPlay.cmd +++ b/Misc/XMPlay.cmd @@ -1,38 +1,111 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +: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=XMPlay +set L_ITEM=xmplay.exe +set L_ARGS="%bin%\XMPlay\music.7z" +set L_7ZIP= +set L_CHCK=True +set L_ELEV= +set L_NCMD=True +set L_WAIT= -:RestoreDefaults -del "xmplay.library" -del "xmplay.library~" -del "xmplay.pls" -call "%bin%\Scripts\Launch.cmd" Program "%bin%\XMPlay" "%bin%\7-Zip\7za.exe" "e defaults.7z -aoa -bsp0 -bso0" -ping -n 2 127.0.0.1>nul +::::::::::::::::::::::::::::::::::::::::::: +:: 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 -call "%bin%\Scripts\Launch.cmd" Program "%bin%\XMPlay" "xmplay.exe" "music.7z" +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Misc/_Update Kit.cmd b/Misc/_Update Kit.cmd deleted file mode 100644 index b430d0ce..00000000 --- a/Misc/_Update Kit.cmd +++ /dev/null @@ -1,38 +0,0 @@ -@echo off - -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - -:Launch -:: Because this script does not have delayed expansion enabled the '!python!' -:: below is passed verbatim to the Launch.cmd script. This results in -:: Launch.cmd resolving the variable instead. By overriding Launch.cmd in this -:: way we gain two things. First, we take advantage of Launch.cmd's ability to -:: use x64 python if possible. Second, by using the native terminal emulator we -:: avoid the issue in ConEmu where rewriting the same line causes major -:: slowdowns; it can be 5 to 30 times slower than normal. -call "%bin%\Scripts\Launch.cmd" Program "%bin%\Scripts" "!python!" "update_kit.py" /max -goto Exit - -:ErrorNoBin -popd -color 4e -echo ".bin" folder not found, aborting script. -echo. -echo Press any key to exit... -pause>nul -color -goto Exit - -:Exit diff --git a/README.md b/README.md index b3a3f94f..0179c68d 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ # README -A collection of scripts to help technicians service Windows systems. +A collection of scripts to help a technician service Windows systems. diff --git a/Repairs/AdwCleaner.cmd b/Repairs/AdwCleaner.cmd index 865e4915..8bdda6ed 100644 --- a/Repairs/AdwCleaner.cmd +++ b/Repairs/AdwCleaner.cmd @@ -1,36 +1,111 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +: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=AdwCleaner +set L_ITEM=AdwCleaner.exe +set L_ARGS= +set L_7ZIP= +set L_CHCK=True +set L_ELEV= +set L_NCMD=True +set L_WAIT= -:Copy -set "prog=AdwCleaner.exe" -mkdir "%bin%\tmp" >nul 2>&1 -copy /y "%bin%\%prog%" "%bin%\tmp\%prog%" +::::::::::::::::::::::::::::::::::::::::::: +:: 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 -call "%bin%\Scripts\Launch.cmd" Program "%bin%\tmp" "%prog%" "" +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Repairs/Autoruns.cmd b/Repairs/Autoruns.cmd index 2157e18a..b48a7877 100644 --- a/Repairs/Autoruns.cmd +++ b/Repairs/Autoruns.cmd @@ -1,20 +1,17 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - -:ModifySettings +:Configure reg add HKCU\Software\Sysinternals\AutoRuns /v checkvirustotal /t REG_DWORD /d 0 /f >nul reg add HKCU\Software\Sysinternals\AutoRuns /v EulaAccepted /t REG_DWORD /d 1 /f >nul reg add HKCU\Software\Sysinternals\AutoRuns /v shownomicrosoft /t REG_DWORD /d 1 /f >nul @@ -26,18 +23,101 @@ reg add HKCU\Software\Sysinternals\AutoRuns\SigCheck /v EulaAccepted /t REG_DWOR reg add HKCU\Software\Sysinternals\AutoRuns\Streams /v EulaAccepted /t REG_DWORD /d 1 /f >nul reg add HKCU\Software\Sysinternals\AutoRuns\VirusTotal /v VirusTotalTermsAccepted /t REG_DWORD /d 1 /f >nul +: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=SysinternalsSuite +set L_ITEM=Autoruns.exe +set L_ARGS=-e +set L_7ZIP=Autoruns* +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 -call "%bin%\Scripts\Launch.cmd" Program "%bin%\SysinternalsSuite" "Autoruns.exe" "-e" +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Repairs/CHKDSK (Fix).cmd b/Repairs/CHKDSK (Fix).cmd index 6e36ac7e..4b903855 100644 --- a/Repairs/CHKDSK (Fix).cmd +++ b/Repairs/CHKDSK (Fix).cmd @@ -1,31 +1,111 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +: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=PyScript +set L_PATH=Scripts +set L_ITEM=check_disk_fix.py +set L_ARGS= +set L_7ZIP= +set L_CHCK=True +set L_ELEV=True +set L_NCMD= +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 -call "%bin%\Scripts\Launch.cmd" PSScript "%bin%\Scripts" "check_disk_fix.ps1" /admin +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Repairs/CHKDSK.cmd b/Repairs/CHKDSK.cmd index ca3f4eb0..99a3c18f 100644 --- a/Repairs/CHKDSK.cmd +++ b/Repairs/CHKDSK.cmd @@ -1,31 +1,111 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +: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=PyScript +set L_PATH=Scripts +set L_ITEM=check_disk.py +set L_ARGS= +set L_7ZIP= +set L_CHCK=True +set L_ELEV=True +set L_NCMD= +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 -call "%bin%\Scripts\Launch.cmd" PSScript "%bin%\Scripts" "check_disk.ps1" /admin +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Repairs/Complete Internet Repair.cmd b/Repairs/Complete Internet Repair.cmd index 77ff23ea..ef583b69 100644 --- a/Repairs/Complete Internet Repair.cmd +++ b/Repairs/Complete Internet Repair.cmd @@ -1,42 +1,127 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - :Init -rem Create %client_dir%\Info\YYYY-MM-DD and set path as %log_dir% +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin call "%bin%\Scripts\init_client_dir.cmd" /Info :LaunchERUNT rem Backup registry first echo Backing up registry... -call "%bin%\Scripts\Launch.cmd" Program "%bin%\erunt" "ERUNT.EXE" "%log_dir%\Registry sysreg curuser otherusers" /admin /wait +set L_TYPE=Program +set L_PATH=erunt +set L_ITEM=ERUNT.EXE +set L_ARGS=%log_dir%\Registry sysreg curuser otherusers +set L_7ZIP= +set L_CHCK= +set L_ELEV=True +set L_NCMD=True +set L_WAIT= +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD +ping -n 5 127.0.0.1>nul + +: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=Complete Internet Repair +set L_ITEM=ComIntRep.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 -call "%bin%\Scripts\Launch.cmd" Program "%bin%\Complete Internet Repair" "ComIntRep.exe" "" - -:Done +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Repairs/DISM.cmd b/Repairs/DISM.cmd index 7070f8b4..da093801 100644 --- a/Repairs/DISM.cmd +++ b/Repairs/DISM.cmd @@ -1,31 +1,111 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +: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=PyScript +set L_PATH=Scripts +set L_ITEM=dism.py +set L_ARGS= +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 -call "%bin%\Scripts\Launch.cmd" PSScript "%bin%\Scripts" "dism.ps1" "" +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Repairs/ESET & KVRT.cmd b/Repairs/ESET & KVRT.cmd deleted file mode 100644 index bbf3c034..00000000 --- a/Repairs/ESET & KVRT.cmd +++ /dev/null @@ -1,38 +0,0 @@ -@echo off - -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - -:Init -rem Set %client_dir% -call "%bin%\Scripts\init_client_dir.cmd" /Quarantine -set "q_dir=%client_dir%\Quarantine\KVRT" -mkdir "%q_dir%">nul 2>&1 - -:Launch -call "%bin%\Scripts\Launch.cmd" Program "%bin%" "ESET.exe" "" -call "%bin%\Scripts\Launch.cmd" Program "%bin%" "KVRT.exe" "-accepteula -d %q_dir% -processlevel 3 -dontcryptsupportinfo -fixednames" -goto Exit - -:ErrorNoBin -popd -color 4e -echo ".bin" folder not found, aborting script. -echo. -echo Press any key to exit... -pause>nul -color -goto Exit - -:Exit diff --git a/Repairs/ESET.cmd b/Repairs/ESET.cmd new file mode 100644 index 00000000..859842f0 --- /dev/null +++ b/Repairs/ESET.cmd @@ -0,0 +1,111 @@ +:: 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=ESET +set L_ITEM=ESET.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% \ No newline at end of file diff --git a/Repairs/JRT.cmd b/Repairs/JRT.cmd index 15d11020..11547b6a 100644 --- a/Repairs/JRT.cmd +++ b/Repairs/JRT.cmd @@ -1,31 +1,111 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +: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=JRT +set L_ITEM=JRT.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 -call "%bin%\Scripts\Launch.cmd" Program "%bin%" "JRT.exe" "" +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Repairs/KVRT.cmd b/Repairs/KVRT.cmd new file mode 100644 index 00000000..67884371 --- /dev/null +++ b/Repairs/KVRT.cmd @@ -0,0 +1,114 @@ +:: 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 +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 + +:: 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% \ No newline at end of file diff --git a/Repairs/MBAM.cmd b/Repairs/MBAM.cmd index 6aaa6c5b..fba00866 100644 --- a/Repairs/MBAM.cmd +++ b/Repairs/MBAM.cmd @@ -1,35 +1,119 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +:InstallOrUpdate +start "" /wait "%bin%\..\Installers\Extras\Security\Malwarebytes Anti-Malware.exe" -:Install -call "%bin%\Scripts\Launch.cmd" Program "%bin%\..\Installers\Extras\Security" "Malwarebytes Anti-Malware.exe" "" /wait +:FindInstallation +set install_path= +if exist "%programfiles%\Malwarebytes Anti-Malware\mbam.exe" (set "install_path=%programfiles%\Malwarebytes Anti-Malware") +if exist "%programfiles(x86)%\Malwarebytes Anti-Malware\mbam.exe" (set "install_path=%programfiles(x86)%\Malwarebytes Anti-Malware") + +: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=%install_path% +set L_ITEM=mbam.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 -if exist "%programfiles%\Malwarebytes Anti-Malware\mbam.exe" (call "%bin%\Scripts\Launch.cmd" Program "%programfiles%\Malwarebytes Anti-Malware" "mbam.exe" "") -if exist "%programfiles(x86)%\Malwarebytes Anti-Malware\mbam.exe" (call "%bin%\Scripts\Launch.cmd" Program "%programfiles(x86)%\Malwarebytes Anti-Malware" "mbam.exe" "") +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Repairs/RKill.cmd b/Repairs/RKill.cmd index 3b80387b..662ad4a6 100644 --- a/Repairs/RKill.cmd +++ b/Repairs/RKill.cmd @@ -1,80 +1,116 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - :Init -setlocal EnableDelayedExpansion -color 1b +setlocal title Wizard Kit: Launcher - -:CheckHardLinks -pushd "%bin%\RKill" -for %%r in (explorer.exe iExplore.exe RKill.com RKill.scr uSeRiNiT.exe WiNlOgOn.exe) do ( - if not exist "%%r" mklink /h %%r RKill.exe>nul 2>&1 -) -popd - -:CreateInfoDir -rem Create %client_dir%\Info\YYYY-MM-DD and set path as !log_dir! +call :CheckFlags %* +call :FindBin call "%bin%\Scripts\init_client_dir.cmd" /Info -:RKill -echo Scanning system with RKill... -call "%bin%\Scripts\Launch.cmd" Program "%bin%" "RKill\RKill.exe" "-l !log_dir!\rkill.log" -choice /c YA /d A /t 300 /m "Did RKill run correctly? Press Y for Yes, A to run Alternative." -if %errorlevel% equ 0 goto Abort -if %errorlevel% equ 1 goto Done -if %errorlevel% equ 2 goto RKillAlt +:UglyHackToOpenRKillFolder +rem "Sleeps" in the background for 10 secs and then opens the RKill folder +start "" /b cmd /c ping -n 10 127.0.0.1^>nul ^& if exist "%bin%\RKill" explorer "%bin%\RKill" -:RKillAlt -echo Scanning system with RKill... -set "prog=RKill\explorer.exe" -call "%bin%\Scripts\Launch.cmd" Program "%bin%" "RKill\explorer.exe" "-l !log_dir!\rkill.log" -choice /c YM /d M /t 300 /m "Did RKill run correctly? Press Y for Yes, M to run manually." -if %errorlevel% equ 0 goto Abort -if %errorlevel% equ 1 goto Done -if %errorlevel% equ 2 goto RKillManual +: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=RKill +set L_ITEM=RKill.exe +set L_ARGS= +set L_7ZIP= +set L_CHCK=True +set L_ELEV= +set L_NCMD=True +set L_WAIT= -:RKillManual -call "%bin%\Scripts\Launch.cmd" Program "%bin%\Explorer++" "Explorer++.exe" "%cd%\RKill" -goto Done +::::::::::::::::::::::::::::::::::::::::::: +:: 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. -echo Aborted. Try running an alternate version manually. +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 -:ErrorNoBin -popd -color 4e -echo ".bin" folder not found, aborting script. -echo. -echo Press any key to exit... -pause>nul -color -goto Exit - -:Done -color -endlocal -goto Exit - +:: Cleanup and exit :: :Exit -goto Exit +endlocal +exit /b %errorlevel% \ No newline at end of file diff --git a/Repairs/SAS (Deprecated).cmd b/Repairs/SAS (Deprecated).cmd index 5c23e464..6992d70c 100644 --- a/Repairs/SAS (Deprecated).cmd +++ b/Repairs/SAS (Deprecated).cmd @@ -1,34 +1,114 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +:InstallOrUpdate +start "" /wait "%bin%\..\Installers\Extras\Security\SUPERAntiSpyware.exe" -:Install -call "%bin%\Scripts\Launch.cmd" Program "%bin%" "SAS.exe" "" /wait +: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=%programfiles%\SUPERAntiSpyware +set L_ITEM=SUPERAntiSpyware.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 -call "%~dp0\..\.bin\Scripts\Launch.cmd" Program "%programfiles%\SUPERAntiSpyware" "SUPERAntiSpyware.exe" "" +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Repairs/SFC Scan.cmd b/Repairs/SFC Scan.cmd index da8082fe..89957df2 100644 --- a/Repairs/SFC Scan.cmd +++ b/Repairs/SFC Scan.cmd @@ -1,31 +1,111 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +: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=PyScript +set L_PATH=Scripts +set L_ITEM=sfc_scan.py +set L_ARGS= +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 -call "%bin%\Scripts\Launch.cmd" Console "%bin%\Scripts" "sfc_scan.cmd" /admin +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Repairs/Shortcut Cleaner.cmd b/Repairs/Shortcut Cleaner.cmd index 54c490bd..0d30f88a 100644 --- a/Repairs/Shortcut Cleaner.cmd +++ b/Repairs/Shortcut Cleaner.cmd @@ -1,31 +1,111 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +: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=Shortcut Cleaner +set L_ITEM=Shortcut Cleaner.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 -call "%bin%\Scripts\Launch.cmd" Program "%bin%" "Shortcut Cleaner.exe" "" +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Repairs/TDSSKiller.cmd b/Repairs/TDSSKiller.cmd index 439f6fa3..d50c24d0 100644 --- a/Repairs/TDSSKiller.cmd +++ b/Repairs/TDSSKiller.cmd @@ -1,40 +1,114 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd - :Init -rem Create %client_dir%\Info\YYYY-MM-DD and set path as %log_dir% -call "%bin%\Scripts\init_client_dir.cmd" /Info /Quarantine - -:CreateQuarantineDir +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin +call "%bin%\Scripts\init_client_dir.cmd" /Quarantine set "q_dir=%client_dir%\Quarantine\TDSSKiller" 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=TDSSKiller +set L_ITEM=TDSSKiller.exe +set L_ARGS=-l %log_dir%\TDSSKiller.log -qpath %q_dir% -accepteula -accepteulaksn -dcexact -tdlfs +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 -call "%bin%\Scripts\Launch.cmd" Program "%bin%" "TDSSKiller.exe" "-l %log_dir%\TDSSKiller.log -qpath %q_dir% -accepteula -accepteulaksn -dcexact -tdlfs" -rem call "%bin%\Scripts\Launch.cmd" Program "%bin%" "TDSSKiller.exe" "-l %log_dir%\TDSSKiller.log -qpath %q_dir% -accepteula -accepteulaksn -dcexact -qsus -tdlfs" +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Reset Browsers.cmd b/Reset Browsers.cmd index 51743af1..4b38cee5 100644 --- a/Reset Browsers.cmd +++ b/Reset Browsers.cmd @@ -1,31 +1,111 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +: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=PyScript +set L_PATH=Scripts +set L_ITEM=reset_browsers.py +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 -call "%bin%\Scripts\Launch.cmd" PSScript "%bin%\Scripts" "reset_browsers.ps1" +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/SW Diagnostics.cmd b/SW Diagnostics.cmd index cd5edadf..c8f2a874 100644 --- a/SW Diagnostics.cmd +++ b/SW Diagnostics.cmd @@ -1,31 +1,111 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +: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=PyScript +set L_PATH=Scripts +set L_ITEM=sw_diagnostics.py +set L_ARGS= +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 -call "%bin%\Scripts\Launch.cmd" PSScript "%bin%\Scripts" "sw_diagnostics.ps1" /admin +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/SW Final Checklist.cmd b/SW Final Checklist.cmd new file mode 100644 index 00000000..3da0b8e2 --- /dev/null +++ b/SW Final Checklist.cmd @@ -0,0 +1,111 @@ +:: 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=PyScript +set L_PATH=Scripts +set L_ITEM=sw_checklist.py +set L_ARGS= +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% \ No newline at end of file diff --git a/Uninstallers/IObit Uninstaller.cmd b/Uninstallers/IObit Uninstaller.cmd index 70b8da71..0db9604d 100644 --- a/Uninstallers/IObit Uninstaller.cmd +++ b/Uninstallers/IObit Uninstaller.cmd @@ -1,31 +1,111 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +: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=IObitUninstaller +set L_ITEM=IObitUninstaler.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 -call "%bin%\Scripts\Launch.cmd" Program "%bin%\IObitUninstaller" "IObitUninstaler.exe" "" /admin +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Uninstallers/Removal Tools.cmd b/Uninstallers/Removal Tools.cmd index d6a0aeca..6c9a91c3 100644 --- a/Uninstallers/Removal Tools.cmd +++ b/Uninstallers/Removal Tools.cmd @@ -1,33 +1,111 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +: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=Folder +set L_PATH=_Removal Tools +set L_ITEM=. +set L_ARGS= +set L_7ZIP= +set L_CHCK=True +set L_ELEV= +set L_NCMD= +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 -pushd "%bin%\_Removal Tools" -call "%bin%\Scripts\Launch.cmd" Program "%windir%" "explorer.exe" "%cd%" -popd +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file diff --git a/Uninstallers/Revo Uninstaller.cmd b/Uninstallers/Revo Uninstaller.cmd index f387d79f..d4d4f678 100644 --- a/Uninstallers/Revo Uninstaller.cmd +++ b/Uninstallers/Revo Uninstaller.cmd @@ -1,31 +1,111 @@ +:: 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 -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin -:FindBin -set bin= & pushd "%~dp0" -:FindBinInner -if exist ".bin" goto FindBinDone -if "%~d0\" == "%cd%" goto ErrorNoBin -cd .. & goto FindBinInner -:FindBinDone -set "bin=%cd%\.bin" & popd +: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=Revo Uninstaller +set L_ITEM=Revouninstaller.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 -call "%bin%\Scripts\Launch.cmd" Program "%bin%\Revo Uninstaller" "Revouninstaller.exe" "" +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD goto Exit -:ErrorNoBin +:: 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 ".bin" folder not found, aborting script. +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% \ No newline at end of file