# Migration to Python started #
* PoSH has an extreme slowdown for some systems while it runs an optimization
** pass for .NET on the first PoSH script execution.
** This is reason enough to move to an alternative.
* New additions:
* User Data Transfer script
* Will extract from a WIM or copy from a folder
* Uses wimlib-imagex for images and FastCopy for folders
* Removes undesired items after transfer/extraction
* HWiNFO
* Missing ODD repair registry patch
* Q-Dir
* SW Bundle install script
* ConEmu
* Moving back to ConEmu for better performance.
* Copy-WizardKit
* Now uses FastCopy
* functions.py
* Ported init.ps1 to Python using functions.py (from WinPE) as a base
* Launch.cmd
* Elevating programs/scripts now done using a temp VBScript file
* Can run Python scripts (using either the 32 or 64 bit runtime)
* transferred_keys.cmd
* Expanded searched paths
* Misc
* Lots of variables and files renamed
* Lots of hard-coded paths are now in variables
* Should only be set in scripts in %bin%\Scripts
* Moved a subset of the Diagnostics launchers to a new 'Extras' folder
* The launchers moved are those that are less-often used
* Refactored FindBin code to be more concise
* Renamed "KitDir" "ClientDir" to indicate that it is on the client's system
* Removed GeForce Experience launcher as it now requires an account
* Added link to NVIDIA's driver webpage to download the correct driver
* Removed AMD's Gaming Evolved launcher
* This is usually bundled with the GPU driver anyway
* Switched back to ConEmu
* Variable and script names are now more descriptive
* i.e. checklist -> final_checklist, and HH -> %kit_dir%
* (not happy with %kit_dir%, will probably change again)
145 lines
No EOL
3.6 KiB
Batchfile
145 lines
No EOL
3.6 KiB
Batchfile
:: Wizard Kit: Wrapper for launching programs and scripts.
|
|
::
|
|
:: Some features:
|
|
:: * If the OS is 64-bit then the WorkingDir is scanned for a 64-bit version of the programs
|
|
:: * Allows for centralized terminal emulation settings management
|
|
:: * Allows for smaller "launcher" scripts to be used as they will rely on this script.
|
|
|
|
@echo off
|
|
|
|
: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
|
|
|
|
: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"
|
|
)
|
|
|
|
: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)
|
|
goto Usage
|
|
|
|
:LaunchConsole
|
|
set "prog=%~3"
|
|
if !arch! equ 64 (
|
|
if exist "!prog:.=64.!" set "prog=!prog:.=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
|
|
|
|
:LaunchOfficeSetup
|
|
set "prog=%~3"
|
|
start "" "%con%" -cmd call "%bin%\copy_office.cmd" "!prog!" -new_console:n
|
|
goto Done
|
|
|
|
:LaunchProgram
|
|
set "prog=%~3"
|
|
if !arch! equ 64 (
|
|
if exist "!prog:.=64.!" set "prog=!prog:.=64.!"
|
|
)
|
|
if not exist "!prog!" goto ProgramNotFound
|
|
if not "%~4" == "" (set "vb_args=%~4")
|
|
if defined admin (
|
|
mkdir "%bin%\tmp"
|
|
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"
|
|
) else (
|
|
if defined max (set "max=/max")
|
|
if defined wait (set "wait=/wait")
|
|
start "" !max! !wait! "!prog!" %~4
|
|
)
|
|
goto Done
|
|
|
|
: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
|
|
|
|
:LaunchPyScript
|
|
set "script=%~3"
|
|
if not exist "!script!" goto ScriptNotFound
|
|
if defined admin (
|
|
start "" "%con%" -run "%python%" "!script!" -new_console:a -new_console:n
|
|
) else (
|
|
start "" "%con%" -run "%python%" "!script!" -new_console:n
|
|
)
|
|
goto Done
|
|
|
|
: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.
|
|
goto Abort
|
|
|
|
:ProgramNotFound
|
|
echo.
|
|
echo Program not found.
|
|
goto Abort
|
|
|
|
:ScriptNotFound
|
|
echo.
|
|
echo Script not found.
|
|
goto Abort
|
|
|
|
:Abort
|
|
color 4e
|
|
echo.
|
|
echo Aborted.
|
|
echo.
|
|
echo Press any key to exit...
|
|
pause>nul
|
|
goto Exit
|
|
|
|
:Done
|
|
goto Exit
|
|
|
|
:Exit
|
|
popd
|
|
endlocal |