WizardKit/.bin/Scripts/Launch.cmd
Alan Mason 3031df5a4c 2016-07: Retroactive Updates
* DISM
  * Much safer WinVer check

* Enter / Exit SafeMode
  * Now enables MSI (un)installers in SafeMode w/ Networking

* Final Checklist
  * NEW: can now be run directly from UFD

* Hide Windows 10 Upgrade.reg
  * Added more registry blocks

* Removed Chocolately
  * Too much volatility
  * Ninite will regain default installer status

* Replaced ConEmu with Cmder
  * Cmder has a heavily modified ConEmu
  * Changed background
  * Added Cmder launchers in Misc

* SW Diagnostics
  * NEW: can now be run directly from UFD
  * BleachBit / Winapp2.ini updated
    * Expanded selections
    * Now only checks temp data size; DOES NOT delete temp data
  * Internet connection test will now loop until the manually exited
  * Now warns you that it can't check Windows activation in SafeMode

* Bugfixes
  * reset_browsers.ps1
    * Should skip "resetting" the backup folders (i.e. Default.wkbak)
2017-11-17 00:50:54 -07:00

109 lines
No EOL
2.6 KiB
Batchfile

@echo off
:Init
setlocal EnableDelayedExpansion
color 1b
title WK 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)
)
:SetVariables
if /i "!PROCESSOR_ARCHITECTURE!" == "AMD64" set "arch=64"
set "con=%~dp0\..\cmder_mini\vendor\conemu-maximus5\ConEmu.exe"
if !arch! equ 64 set "con=%~dp0\..\cmder_mini\vendor\conemu-maximus5\ConEmu.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)
goto Usage
:LaunchConsole
set "prog=%~3"
dir "!prog:.=64.!" >nul 2>&1 && if !arch! equ 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 "copy_office.cmd" "!prog!" -new_console:n
goto Done
:LaunchProgram
set "prog=%~3"
dir "!prog:.=64.!" >nul 2>&1 && if !arch! equ 64 set "prog=!prog:.=64.!"
if not exist "!prog!" goto ProgramNotFound
if not "%~4" == "" (set "ps_args=-argumentlist '%~4'")
if defined admin (
if defined max (set "max=-WindowStyle Maximized")
if defined wait (set "wait=-Wait")
powershell -command "& {start '!prog!' !ps_args! -verb runas !max! !wait!}"
) 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%" -cmd PowerShell -ExecutionPolicy Bypass -File "!script!" -NoProfile -new_console:a !wait!
) else (
start "" "%con%" -cmd PowerShell -ExecutionPolicy Bypass -File "!script!" -NoProfile !wait!
)
goto Done
:Usage
echo.
echo.Usage: Launch.cmd Console "Working Dir" "Program" "Args" [/admin]
echo. Launch.cmd Program "Working Dir" "Program" "Args" [/admin] [/max] [/wait]
echo. Launch.cmd PSScript "Working Dir" "Program" "" [/admin] [/wait]
echo. (Args should be empty when using PSScript)
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
color
endlocal