diff --git a/.bin/Scripts/Launch.cmd b/.bin/Scripts/Launch.cmd index efcc37f7..fd72d374 100644 --- a/.bin/Scripts/Launch.cmd +++ b/.bin/Scripts/Launch.cmd @@ -60,131 +60,264 @@ 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=") +if /i not "%L__CLI%" == "True" (set "L__CLI=") :RelaunchInConEmu -set USE_CONEMU=True -if defined IN_CONEMU set "USE_CONEMU=" -if defined L_NCMD set "USE_CONEMU=" -if "%L_TYPE%" == "PSScript" set "USE_CONEMU=" -if "%L_TYPE%" == "PyScript" set "USE_CONEMU=" +set RELOAD_IN_CONEMU=True +if defined ConEmuBuild set "RELOAD_IN_CONEMU=" +if defined L_NCMD set "RELOAD_IN_CONEMU=" +if "%L_TYPE%" == "Executable" set "RELOAD_IN_CONEMU=" +if "%L_TYPE%" == "PSScript" set "RELOAD_IN_CONEMU=" +if "%L_TYPE%" == "PyScript" set "RELOAD_IN_CONEMU=" -if defined USE_CONEMU ( +if defined RELOAD_IN_CONEMU ( 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%" == "Executable" (goto LaunchExecutable) if /i "%L_TYPE%" == "Folder" (goto LaunchFolder) -if /i "%L_TYPE%" == "Office" (goto LaunchOfficeSetup) -if /i "%L_TYPE%" == "QuickBooks" (goto LaunchQuickBooksSetup) -if /i "%L_TYPE%" == "Program" (goto LaunchProgram) +if /i "%L_TYPE%" == "Office" (goto LaunchOffice) if /i "%L_TYPE%" == "PSScript" (goto LaunchPSScript) if /i "%L_TYPE%" == "PyScript" (goto LaunchPyScript) +if /i "%L_TYPE%" == "QuickBooks" (goto LaunchQuickBooksSetup) goto Usage -:LaunchConsole -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 +:LaunchExecutable +rem Prep +call :ExtractOrFindPath || 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 ErrorProgramNotFound + +rem Run popd && pushd "%_path%" -rem Run program in console emulator %CON% and catch error(s) +if defined L__CLI goto LaunchExecutableCLI +if defined L_ELEV ( + goto LaunchExecutableElev +) else ( + goto LaunchExecutableUser +) + +:LaunchExecutableCLI +rem Prep +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 Run start "" "%CON%" -run "%prog%" %L_ARGS% %con_args% || goto ErrorUnknown goto Exit +:LaunchExecutableElev +rem Prep +call :DeQuote prog +call :DeQuote L_ARGS + +rem Create VB script +mkdir "%bin%\tmp" 2>nul +echo Set UAC = CreateObject^("Shell.Application"^) > "%bin%\tmp\Elevate.vbs" +echo UAC.ShellExecute "%prog%", "%L_ARGS%", "", "runas", 1 >> "%bin%\tmp\Elevate.vbs" + +rem Run +"%systemroot%\System32\cscript.exe" //nologo "%bin%\tmp\Elevate.vbs" || goto ErrorUnknown +goto Exit + +:LaunchExecutableUser +rem Run +start "" "%prog%" %L_ARGS% || goto ErrorUnknown +goto Exit + :LaunchFolder -rem Test L_PATH and set %_path% (extracts archive in necessary) -call :TestPath || goto ErrorProgramNotFound +rem Prep +call :ExtractOrFindPath || goto ErrorProgramNotFound + +rem Run start "" "explorer.exe" "%_path%" || goto ErrorUnknown goto Exit -:LaunchOfficeSetup -rem set args and copy setup files to system -rem NOTE: init_client_dir.cmd sets %client_dir% and creates %client_dir%\Office folder +:LaunchOffice 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_PASSWORD% -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 + goto LaunchOfficeODT ) 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 LaunchOfficeSetup ) + +:LaunchOfficeODT +rem Prep +set "args=-aoa -bso0 -bse0 -bsp0 -p%ARCHIVE_PASSWORD%" +set "config=%L_ITEM%" +set "dest=%client_dir%\Office\%L_PATH%" +set "odt_exe=%L_PATH%\setup.exe" +set "source=%cbin%\_Office.7z" + +rem Extract +if not exist "%source%" (goto ErrorODTSourceNotFound) +"%SEVEN_ZIP%" e "%source%" %args% -o"%dest%" %odt_exe% %config% || exit /b 1 +"%systemroot%\System32\ping.exe" -n 2 127.0.0.1>nul + +rem Verify +if not exist "%dest%\setup.exe" (goto ErrorODTSourceNotFound) +if not exist "%dest%\%config%" (goto ErrorODTSourceNotFound) +pushd "%dest%" + +rem Run +rem # The line below jumps to ErrorUnknown even when it runs 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 %config% +popd goto Exit -:LaunchQuickBooksSetup -rem set args and copy setup files to system -rem NOTE: init_client_dir.cmd sets %client_dir% and creates %client_dir%\QuickBooks folder -call "%bin%\Scripts\init_client_dir.cmd" /QuickBooks -echo Copying setup file(s) for %L_ITEM%... -rem copy setup files from QUICKBOOKS_SERVER_IP +:LaunchOfficeSetup +rem Prep 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=\\%QUICKBOOKS_SERVER_IP%\QuickBooks\!product!" +set "source=\\%OFFICE_SERVER_IP%\Office\%product%" +set "dest=%client_dir%\Office" + +rem Verify +if not exist "%source%" (goto ErrorOfficeSourceNotFound) + +rem Copy +echo Copying setup file(s) for %product_name%... +start "" /wait "%FASTCOPY%" %fastcopy_args% "%source%" /to="%dest%\" + +rem Run +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 + +:LaunchPSScript +rem Prep +call :ExtractOrFindPath || goto ErrorProgramNotFound +set "script=%_path%\%L_ITEM%" +set "ps_args=-ExecutionPolicy Bypass -NoProfile" + +rem Verify +if not exist "%script%" goto ErrorScriptNotFound + +rem Run +popd && pushd "%_path%" +if defined L_ELEV ( + goto LaunchPSScriptElev +) else ( + goto LaunchPSScriptUser +) + +:LaunchPSScriptElev +rem Prep +call :DeQuote script + +rem Create VB script +mkdir "%bin%\tmp" 2>nul +echo Set UAC = CreateObject^("Shell.Application"^) > "%bin%\tmp\Elevate.vbs" +if defined L_NCMD ( + rem use Powershell's window instead of %CON% + echo UAC.ShellExecute "%POWERSHELL%", "%ps_args% -File "%script%"", "", "runas", 3 >> "%bin%\tmp\Elevate.vbs" +) else ( + echo UAC.ShellExecute "%CON%", "-run %POWERSHELL% %ps_args% -File "%script%" -new_console:n", "", "runas", 1 >> "%bin%\tmp\Elevate.vbs" +) + +rem Run +"%systemroot%\System32\cscript.exe" //nologo "%bin%\tmp\Elevate.vbs" || goto ErrorUnknown +goto Exit + +:LaunchPSScriptUser +rem Run +if defined L_NCMD ( + start "" "%POWERSHELL%" %ps_args% -File "%script%" || goto ErrorUnknown +) else ( + start "" "%CON%" -run "%POWERSHELL%" %ps_args% -File "%script%" -new_console:n || goto ErrorUnknown +) +goto Exit + +:LaunchPyScript +rem Prep +call :ExtractOrFindPath || goto ErrorProgramNotFound +set "script=%_path%\%L_ITEM%" + +rem Verify +if not exist "%script%" goto ErrorScriptNotFound + +rem Run +if defined L_ELEV ( + goto LaunchPyScriptElev +) else ( + goto LaunchPyScriptUser +) + +:LaunchPyScriptElev +rem Prep +call :DeQuote script + +rem Create VB script +mkdir "%bin%\tmp" 2>nul +echo Set UAC = CreateObject^("Shell.Application"^) > "%bin%\tmp\Elevate.vbs" +if defined L_NCMD ( + echo UAC.ShellExecute "%PYTHON%", "%script%", "", "runas", 3 >> "%bin%\tmp\Elevate.vbs" +) else ( + echo UAC.ShellExecute "%CON%", "-run %PYTHON% %script% -new_console:n", "", "runas", 1 >> "%bin%\tmp\Elevate.vbs" +) + +rem Run +"%systemroot%\System32\cscript.exe" //nologo "%bin%\tmp\Elevate.vbs" || goto ErrorUnknown +goto Exit + +:LaunchPyScriptUser +if defined L_NCMD ( + start "" "%PYTHON%" "%script%" || goto ErrorUnknown +) else ( + start "" "%CON%" -run "%PYTHON%" "%script%" -new_console:n || goto ErrorUnknown +) +goto Exit + +:LaunchQuickBooksSetup +rem Prep +call "%bin%\Scripts\init_client_dir.cmd" /QuickBooks +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=\\%QUICKBOOKS_SERVER_IP%\QuickBooks\%product%" set "dest=%client_dir%\QuickBooks" -rem Verify source -if not exist "!source!" (goto ErrorQuickBooksSourceNotFound) -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" ( - pushd "!dest!\!product_name!" - start "" "!dest!\!product_name!\Setup.exe" || goto ErrorUnknown + +rem Verify +if not exist "%source%" (goto ErrorQuickBooksSourceNotFound) + +rem Copy +echo Copying setup file(s) for %L_ITEM%... +start "" /wait "%FASTCOPY%" %fastcopy_args% "%source%" /to="%dest%\" + +rem Run +if exist "%dest%\%product_name%\Setup.exe" ( + pushd "%dest%\%product_name%" + start "" "%dest%\%product_name%\Setup.exe" || goto ErrorUnknown popd ) else ( rem QuickBooks source not supported by this script @@ -192,99 +325,21 @@ if exist "!dest!\!product_name!\Setup.exe" ( ) goto Exit -:LaunchProgram -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 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!", "!L_ARGS!", "", "runas", 1 >> "%bin%\tmp\Elevate.vbs" - "%systemroot%\System32\cscript.exe" //nologo "%bin%\tmp\Elevate.vbs" || goto ErrorUnknown -) else ( - if defined L_WAIT (set "wait=/wait") - start "" %wait% "%prog%" %L_ARGS% || goto ErrorUnknown -) -goto Exit - -:LaunchPSScript -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 -NoProfile" -if not exist "%script%" goto ErrorScriptNotFound -if defined L_ELEV ( - call :DeQuote script - mkdir "%bin%\tmp" 2>nul - rem Create a temporary VB script to elevate the specified program - echo Set UAC = CreateObject^("Shell.Application"^) > "%bin%\tmp\Elevate.vbs" - if defined L_NCMD ( - rem use Powershell's window instead of %CON% - echo UAC.ShellExecute "%POWERSHELL%", "%ps_args% -File "!script!"", "", "runas", 3 >> "%bin%\tmp\Elevate.vbs" - ) else ( - echo UAC.ShellExecute "%CON%", "-run %POWERSHELL% %ps_args% -File "!script!" -new_console:n", "", "runas", 1 >> "%bin%\tmp\Elevate.vbs" - ) - "%systemroot%\System32\cscript.exe" //nologo "%bin%\tmp\Elevate.vbs" || goto ErrorUnknown -) else ( - if defined L_NCMD ( - start "" "%POWERSHELL%" %ps_args% -File "%script%" || goto ErrorUnknown - ) else ( - start "" "%CON%" -run "%POWERSHELL%" %ps_args% -File "%script%" -new_console:n || goto ErrorUnknown - ) -) -goto Exit - -:LaunchPyScript -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 - mkdir "%bin%\tmp" 2>nul - rem Create a temporary VB script to elevate the specified program - echo Set UAC = CreateObject^("Shell.Application"^) > "%bin%\tmp\Elevate.vbs" - if defined L_NCMD ( - rem use Python's window instead of %CON% - echo UAC.ShellExecute "%PYTHON%", "!script!", "", "runas", 3 >> "%bin%\tmp\Elevate.vbs" - ) else ( - echo UAC.ShellExecute "%CON%", "-run %PYTHON% !script! -new_console:n", "", "runas", 1 >> "%bin%\tmp\Elevate.vbs" - ) - "%systemroot%\System32\cscript.exe" //nologo "%bin%\tmp\Elevate.vbs" || goto ErrorUnknown -) else ( - if defined L_NCMD ( - start "" "%PYTHON%" "%script%" || goto ErrorUnknown - ) else ( - start "" "%CON%" -run "%PYTHON%" "%script%" -new_console:n || goto ErrorUnknown - ) -) -goto Exit - :Usage echo. 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. QuickBooks 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. Executable Working Dir Program Args [L_7ZIP] [L_ELEV] [L__CLI] +echo. Folder Folder '.' [L_7ZIP] +echo. Office Year Product [L_7ZIP] +echo. PSScript Scripts Script [L_7ZIP] [L_ELEV] [L_NCMD] +echo. PyScript Scripts Script [L_7ZIP] [L_ELEV] [L_NCMD] +echo. QuickBooks Year Product [L_7ZIP] +echo. +echo.L_7ZIP: Extra arguments for 7-Zip (in the :ExtractCBin label) +echo.L_ELEV: Elevate to run as Admin +echo.L_NCMD: Do not run script inside ConEmu (i.e. use the native window) +echo.L__CLI: Run executable in ConEmu echo. goto Abort @@ -297,12 +352,12 @@ for /f "delims=" %%a in ('echo %%%1%%') do set %1=%%~a :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_PASSWORD% -o"%bin%\%L_PATH%" %L_7ZIP% || exit /b 1 -) else ( - "%SEVEN_ZIP%" x "%cbin%\%L_PATH%.7z" -aos -bso0 -bse0 -p%ARCHIVE_PASSWORD% -o"%bin%\%L_PATH%" %L_7ZIP% || exit /b 1 -) +echo Extracting "%L_PATH%"... +set "source=%cbin%\%L_PATH%.7z" +set "dest=%bin%\%L_PATH%" +set "args=-aos -bso0 -bse0 -bsp0 -p%ARCHIVE_PASSWORD%" +if defined DEBUG (set "args=-aos -p%ARCHIVE_PASSWORD%") +"%SEVEN_ZIP%" x "%source%" %args% -o"%dest%" %L_7ZIP% || exit /b 1 ping.exe -n 2 127.0.0.1>nul exit /b 0 @@ -334,12 +389,12 @@ if not "%_tmp%" == "%_tmp:*\=%" (goto GetBasenameInner) set "%1=%_tmp%" @exit /b 0 -:TestPath +:ExtractOrFindPath 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. +rem NOTE: This function should be called as 'call :ExtractOrFindPath || goto ErrorProgramNotFound' to catch invalid paths. set _path= if exist "%cbin%\%L_PATH%.7z" ( call :ExtractCBin @@ -363,6 +418,11 @@ echo. echo ERROR: ".bin" folder not found. goto Abort +:ErrorODTSourceNotFound +echo. +echo ERROR: Office Deployment Tool source not found. +goto Abort + :ErrorOfficeSourceNotFound echo. echo ERROR: Office source "%L_ITEM%" not found. @@ -404,10 +464,10 @@ goto Abort :Abort rem Handle color theme for both the native console and ConEmu -if defined L_NCMD ( - color 4e -) else ( +if defined ConEmuBuild ( color c4 +) else ( + color 4e ) echo Aborted. echo. @@ -415,23 +475,18 @@ 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_7ZIP: %L_7ZIP% echo. L_ELEV: %L_ELEV% echo. L_NCMD: %L_NCMD% -echo. L_WAIT: %L_WAIT% +echo. L__CLI: %L__CLI% 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 - ) -) +echo Press any key to exit... +pause>nul +rem reset color and reset errorlevel to 0 +rem NOTE: This is done to avoid causing a ErrorLaunchCMD in the launcher.cmd color -rem Set errorlevel to 1 by calling color incorrectly -color 00 goto Exit :: Cleanup and exit :: diff --git a/.bin/Scripts/Launcher_Template.cmd b/.bin/Scripts/Launcher_Template.cmd index c7078e1c..d5b68d9b 100644 --- a/.bin/Scripts/Launcher_Template.cmd +++ b/.bin/Scripts/Launcher_Template.cmd @@ -17,32 +17,15 @@ call :SetTitle Launcher rem EXTRA_CODE :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 +:: See %bin%\SCripts\Launch.cmd for details under :Usage label set L_TYPE= set L_PATH= set L_ITEM= set L_ARGS= +set L__CLI= set L_7ZIP= -set L_CHCK= set L_ELEV= set L_NCMD= -set L_WAIT= ::::::::::::::::::::::::::::::::::::::::::: :: Do not edit anything below this line! :: diff --git a/.bin/Scripts/functions/update.py b/.bin/Scripts/functions/update.py index e4be0921..f272912a 100644 --- a/.bin/Scripts/functions/update.py +++ b/.bin/Scripts/functions/update.py @@ -180,7 +180,6 @@ def scan_for_net_installers(server, family_name, min_year): 'L_TYPE': family_name, 'L_PATH': year.name, 'L_ITEM': version.name, - 'L_CHCK': 'True', } umount_network_share(server) diff --git a/.bin/Scripts/settings/launchers.py b/.bin/Scripts/settings/launchers.py index b87e0322..46e8c9d3 100644 --- a/.bin/Scripts/settings/launchers.py +++ b/.bin/Scripts/settings/launchers.py @@ -6,71 +6,63 @@ LAUNCHERS = { 'L_TYPE': 'PyScript', 'L_PATH': 'Scripts', 'L_ITEM': 'activate.py', - 'L_CHCK': 'True', 'L_ELEV': 'True', }, 'Enter SafeMode': { 'L_TYPE': 'PyScript', 'L_PATH': 'Scripts', 'L_ITEM': 'safemode_enter.py', - 'L_CHCK': 'True', 'L_ELEV': 'True', }, 'Exit SafeMode': { 'L_TYPE': 'PyScript', 'L_PATH': 'Scripts', 'L_ITEM': 'safemode_exit.py', - 'L_CHCK': 'True', 'L_ELEV': 'True', }, 'System Checklist': { 'L_TYPE': 'PyScript', 'L_PATH': 'Scripts', 'L_ITEM': 'system_checklist.py', - 'L_CHCK': 'True', 'L_ELEV': 'True', }, 'System Diagnostics': { 'L_TYPE': 'PyScript', 'L_PATH': 'Scripts', 'L_ITEM': 'system_diagnostics.py', - 'L_CHCK': 'True', 'L_ELEV': 'True', }, 'User Checklist': { 'L_TYPE': 'PyScript', 'L_PATH': 'Scripts', 'L_ITEM': 'user_checklist.py', - 'L_CHCK': 'True', }, }, r'Data Recovery': { 'PhotoRec (CLI)': { - 'L_TYPE': 'Console', + 'L_TYPE': 'Executable', 'L_PATH': 'TestDisk', 'L_ITEM': 'photorec_win.exe', - 'L_CHCK': 'True', 'L_ELEV': 'True', + 'L__CLI': 'True', }, 'PhotoRec': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'TestDisk', 'L_ITEM': 'qphotorec_win.exe', - 'L_CHCK': 'True', 'L_ELEV': 'True', - 'L_NCMD': 'True', }, 'TestDisk': { - 'L_TYPE': 'Console', + 'L_TYPE': 'Executable', 'L_PATH': 'TestDisk', 'L_ITEM': 'testdisk_win.exe', - 'L_CHCK': 'True', 'L_ELEV': 'True', + 'L__CLI': 'True', }, }, r'Data Transfers': { 'FastCopy (as ADMIN)': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'FastCopy', 'L_ITEM': 'FastCopy.exe', 'L_ARGS': ( @@ -112,15 +104,13 @@ LAUNCHERS = { r'Thumbs.db' r' /to=%client_dir%\Transfer_%iso_date%\ ' ), - 'L_CHCK': 'True', 'L_ELEV': 'True', - 'L_NCMD': 'True', 'Extra Code': [ r'call "%bin%\Scripts\init_client_dir.cmd" /Info /Transfer', ], }, 'FastCopy': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'FastCopy', 'L_ITEM': 'FastCopy.exe', 'L_ARGS': ( @@ -162,14 +152,12 @@ LAUNCHERS = { r'Thumbs.db' r' /to=%client_dir%\Transfer_%iso_date%\ ' ), - 'L_CHCK': 'True', - 'L_NCMD': 'True', 'Extra Code': [ r'call "%bin%\Scripts\init_client_dir.cmd" /Info /Transfer', ], }, 'KVRT': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'KVRT', 'L_ITEM': 'KVRT.exe', 'L_ARGS': ( @@ -179,8 +167,6 @@ LAUNCHERS = { r' -dontcryptsupportinfo' r' -fixednames' ), - 'L_CHCK': 'True', - 'L_NCMD': 'True', 'Extra Code': [ r'call "%bin%\Scripts\init_client_dir.cmd" /Quarantine', r'set "q_dir=%client_dir%\Quarantine\KVRT"', @@ -191,41 +177,33 @@ LAUNCHERS = { 'L_TYPE': 'PyScript', 'L_PATH': 'Scripts', 'L_ITEM': 'transferred_keys.py', - 'L_CHCK': 'True', 'L_ELEV': 'True', }, 'User Data Transfer': { 'L_TYPE': 'PyScript', 'L_PATH': 'Scripts', 'L_ITEM': 'user_data_transfer.py', - 'L_CHCK': 'True', 'L_ELEV': 'True', }, 'XYplorer (as ADMIN)': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'XYplorerFree', 'L_ITEM': 'XYplorerFree.exe', 'L_ARGS': r'/exp /win=max %userprofile%', - 'L_CHCK': 'True', 'L_ELEV': 'True', - 'L_NCMD': 'True', }, 'XYplorer': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'XYplorerFree', 'L_ITEM': 'XYplorerFree.exe', 'L_ARGS': r'/exp /win=max %userprofile%', - 'L_CHCK': 'True', - 'L_NCMD': 'True', }, }, r'Diagnostics': { 'HWiNFO': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'HWiNFO', 'L_ITEM': 'HWiNFO.exe', - 'L_CHCK': 'True', - 'L_NCMD': 'True', 'Extra Code': [ r'for %%a in (32 64) do (', r' copy /y "%bin%\HWiNFO\general.ini" "%bin%\HWiNFO\HWiNFO%%a.ini"', @@ -235,12 +213,10 @@ LAUNCHERS = { ], }, 'ProduKey': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'ProduKey', 'L_ITEM': 'ProduKey.exe', - 'L_CHCK': 'True', 'L_ELEV': 'True', - 'L_NCMD': 'True', 'Extra Code': [ r'if exist "%bin%\ProduKey" (', r' del "%bin%\ProduKey\ProduKey.cfg" 2>nul', @@ -251,19 +227,15 @@ LAUNCHERS = { }, r'Diagnostics\Extras': { 'AIDA64': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'AIDA64', 'L_ITEM': 'aida64.exe', - 'L_CHCK': 'True', - 'L_NCMD': 'True', }, 'Autoruns (with VirusTotal Scan)': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'Autoruns', 'L_ITEM': 'Autoruns.exe', 'L_ARGS': '-e', - 'L_CHCK': 'True', - 'L_NCMD': 'True', 'Extra Code': [ r'reg add HKCU\Software\Sysinternals\AutoRuns /v checkvirustotal /t REG_DWORD /d 1 /f >nul', r'reg add HKCU\Software\Sysinternals\AutoRuns /v EulaAccepted /t REG_DWORD /d 1 /f >nul', @@ -278,48 +250,38 @@ LAUNCHERS = { ], }, 'BleachBit': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'BleachBit', 'L_ITEM': 'bleachbit.exe', - 'L_CHCK': 'True', - 'L_NCMD': 'True', }, 'BlueScreenView': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'BlueScreenView', 'L_ITEM': 'BlueScreenView.exe', - 'L_CHCK': 'True', 'L_ELEV': 'True', - 'L_NCMD': 'True', }, 'ERUNT': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'erunt', 'L_ITEM': 'ERUNT.EXE', 'L_ARGS': '%log_dir%\Registry sysreg curuser otherusers', - 'L_CHCK': 'True', 'L_ELEV': 'True', - 'L_NCMD': 'True', 'Extra Code': [ r'call "%bin%\Scripts\init_client_dir.cmd" /Info', ], }, 'HitmanPro': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'HitmanPro', 'L_ITEM': 'HitmanPro.exe', - 'L_CHCK': 'True', - 'L_NCMD': 'True', 'Extra Code': [ r'call "%bin%\Scripts\init_client_dir.cmd" /Info', ], }, 'HWiNFO (Sensors)': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'HWiNFO', 'L_ITEM': 'HWiNFO.exe', - 'L_CHCK': 'True', - 'L_NCMD': 'True', 'Extra Code': [ r'for %%a in (32 64) do (', r' copy /y "%bin%\HWiNFO\general.ini" "%bin%\HWiNFO\HWiNFO%%a.ini"', @@ -331,49 +293,38 @@ LAUNCHERS = { }, r'Drivers': { 'Intel RST (Current Release)': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': '_Drivers\Intel RST', 'L_ITEM': 'SetupRST_15.8.exe', 'L_7ZIP': 'SetupRST_15.8.exe', - 'L_CHCK': 'True', - 'L_NCMD': 'True', }, 'Intel RST (Previous Releases)': { 'L_TYPE': 'Folder', 'L_PATH': '_Drivers\Intel RST', 'L_ITEM': '.', - 'L_CHCK': 'True', 'L_NCMD': 'True', }, 'Intel SSD Toolbox': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': r'_Drivers\Intel SSD Toolbox', 'L_ITEM': 'Intel SSD Toolbox.exe', - 'L_CHCK': 'True', - 'L_NCMD': 'True', }, 'Samsing Magician': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': r'_Drivers\Samsung Magician', 'L_ITEM': 'Samsung Magician.exe', - 'L_CHCK': 'True', - 'L_NCMD': 'True', }, 'Snappy Driver Installer Origin': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': '_Drivers\SDIO', 'L_ITEM': 'SDIO.exe', - 'L_CHCK': 'True', - 'L_NCMD': 'True', }, }, r'Drivers\Extras': { 'Acer': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'HWiNFO', 'L_ITEM': 'HWiNFO.exe', - 'L_CHCK': 'True', - 'L_NCMD': 'True', 'Extra Code': [ r'for %%a in (32 64) do (', r' copy /y "%bin%\HWiNFO\general.ini" "%bin%\HWiNFO\HWiNFO%%a.ini"', @@ -384,11 +335,9 @@ LAUNCHERS = { ], }, 'Lenovo': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'HWiNFO', 'L_ITEM': 'HWiNFO.exe', - 'L_CHCK': 'True', - 'L_NCMD': 'True', 'Extra Code': [ r'for %%a in (32 64) do (', r' copy /y "%bin%\HWiNFO\general.ini" "%bin%\HWiNFO\HWiNFO%%a.ini"', @@ -399,11 +348,9 @@ LAUNCHERS = { ], }, 'Toshiba': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'HWiNFO', 'L_ITEM': 'HWiNFO.exe', - 'L_CHCK': 'True', - 'L_NCMD': 'True', 'Extra Code': [ r'for %%a in (32 64) do (', r' copy /y "%bin%\HWiNFO\general.ini" "%bin%\HWiNFO\HWiNFO%%a.ini"', @@ -419,7 +366,6 @@ LAUNCHERS = { 'L_TYPE': 'PyScript', 'L_PATH': 'Scripts', 'L_ITEM': 'install_sw_bundle.py', - 'L_CHCK': 'True', 'L_ELEV': 'True', }, }, @@ -428,25 +374,25 @@ LAUNCHERS = { 'L_TYPE': 'Office', 'L_PATH': '2013', 'L_ITEM': 'hb_32.xml', - 'L_CHCK': 'True', + 'L_NCMD': 'True', }, 'Home and Business 2013 (x64)': { 'L_TYPE': 'Office', 'L_PATH': '2013', 'L_ITEM': 'hb_64.xml', - 'L_CHCK': 'True', + 'L_NCMD': 'True', }, 'Home and Student 2013 (x32)': { 'L_TYPE': 'Office', 'L_PATH': '2013', 'L_ITEM': 'hs_32.xml', - 'L_CHCK': 'True', + 'L_NCMD': 'True', }, 'Home and Student 2013 (x64)': { 'L_TYPE': 'Office', 'L_PATH': '2013', 'L_ITEM': 'hs_64.xml', - 'L_CHCK': 'True', + 'L_NCMD': 'True', }, }, r'Installers\Extras\Office\2016': { @@ -454,117 +400,97 @@ LAUNCHERS = { 'L_TYPE': 'Office', 'L_PATH': '2016', 'L_ITEM': 'hb_32.xml', - 'L_CHCK': 'True', + 'L_NCMD': 'True', }, 'Home and Business 2016 (x64)': { 'L_TYPE': 'Office', 'L_PATH': '2016', 'L_ITEM': 'hb_64.xml', - 'L_CHCK': 'True', + 'L_NCMD': 'True', }, 'Home and Student 2016 (x32)': { 'L_TYPE': 'Office', 'L_PATH': '2016', 'L_ITEM': 'hs_32.xml', - 'L_CHCK': 'True', + 'L_NCMD': 'True', }, 'Home and Student 2016 (x64)': { 'L_TYPE': 'Office', 'L_PATH': '2016', 'L_ITEM': 'hs_64.xml', - 'L_CHCK': 'True', + 'L_NCMD': 'True', }, 'Office 365 2016 (x32)': { 'L_TYPE': 'Office', 'L_PATH': '2016', 'L_ITEM': '365_32.xml', - 'L_CHCK': 'True', + 'L_NCMD': 'True', }, 'Office 365 2016 (x64)': { 'L_TYPE': 'Office', 'L_PATH': '2016', 'L_ITEM': '365_64.xml', - 'L_CHCK': 'True', + 'L_NCMD': 'True', }, }, r'Misc': { 'ConEmu (as ADMIN)': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'ConEmu', 'L_ITEM': 'ConEmu.exe', - 'L_CHCK': 'True', 'L_ELEV': 'True', - 'L_NCMD': 'True', }, 'ConEmu': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'ConEmu', 'L_ITEM': 'ConEmu.exe', - 'L_CHCK': 'True', - 'L_NCMD': 'True', }, 'Everything': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'Everything', 'L_ITEM': 'Everything.exe', 'L_ARGS': '-nodb', - 'L_CHCK': 'True', 'L_ELEV': 'True', - 'L_NCMD': 'True', }, 'Notepad++': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'notepadplusplus', 'L_ITEM': 'notepadplusplus.exe', - 'L_CHCK': 'True', - 'L_NCMD': 'True', }, 'PuTTY': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'PuTTY', 'L_ITEM': 'PUTTY.EXE', - 'L_CHCK': 'True', - 'L_NCMD': 'True', }, 'TreeSizeFree': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'TreeSizeFree', 'L_ITEM': 'TreeSizeFree.exe', - 'L_CHCK': 'True', 'L_ELEV': 'True', - 'L_NCMD': 'True', }, 'Update Kit': { 'L_TYPE': 'PyScript', 'L_PATH': 'Scripts', 'L_ITEM': 'update_kit.py', - 'L_CHCK': 'True', }, 'XMPlay': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'XMPlay', 'L_ITEM': 'xmplay.exe', 'L_ARGS': '"%bin%\XMPlay\music.7z"', - 'L_CHCK': 'True', - 'L_NCMD': 'True', }, }, r'Repairs': { 'AdwCleaner': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'AdwCleaner', 'L_ITEM': 'AdwCleaner.exe', - 'L_CHCK': 'True', - 'L_NCMD': 'True', }, 'Autoruns': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'Autoruns', 'L_ITEM': 'Autoruns.exe', 'L_ARGS': '-e', - 'L_7ZIP': 'Autoruns*', - 'L_CHCK': 'True', - 'L_NCMD': 'True', 'Extra Code': [ r'reg add HKCU\Software\Sysinternals\AutoRuns /v checkvirustotal /t REG_DWORD /d 0 /f >nul', r'reg add HKCU\Software\Sysinternals\AutoRuns /v EulaAccepted /t REG_DWORD /d 1 /f >nul', @@ -582,19 +508,16 @@ LAUNCHERS = { 'L_TYPE': 'PyScript', 'L_PATH': 'Scripts', 'L_ITEM': 'check_disk.py', - 'L_CHCK': 'True', 'L_ELEV': 'True', }, 'DISM': { 'L_TYPE': 'PyScript', 'L_PATH': 'Scripts', 'L_ITEM': 'dism.py', - 'L_CHCK': 'True', 'L_ELEV': 'True', - 'L_NCMD': 'TRUE', }, 'KVRT': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'KVRT', 'L_ITEM': 'KVRT.exe', 'L_ARGS': ( @@ -604,8 +527,6 @@ LAUNCHERS = { r' -dontcryptsupportinfo' r' -fixednames' ), - 'L_CHCK': 'True', - 'L_NCMD': 'True', 'Extra Code': [ r'call "%bin%\Scripts\init_client_dir.cmd" /Quarantine', r'set "q_dir=%client_dir%\Quarantine\KVRT"', @@ -613,11 +534,9 @@ LAUNCHERS = { ], }, 'RKill': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'RKill', 'L_ITEM': 'RKill.exe', - 'L_CHCK': 'True', - 'L_NCMD': 'True', 'Extra Code': [ r'call "%bin%\Scripts\init_client_dir.cmd" /Info', ], @@ -626,12 +545,10 @@ LAUNCHERS = { 'L_TYPE': 'PyScript', 'L_PATH': 'Scripts', 'L_ITEM': 'sfc_scan.py', - 'L_CHCK': 'True', 'L_ELEV': 'True', - 'L_NCMD': 'True', }, 'TDSSKiller': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'TDSSKiller', 'L_ITEM': 'TDSSKiller.exe', 'L_ARGS': ( @@ -642,8 +559,6 @@ LAUNCHERS = { r' -dcexact' r' -tdlfs' ), - 'L_CHCK': 'True', - 'L_NCMD': 'True', 'Extra Code': [ r'call "%bin%\Scripts\init_client_dir.cmd" /Quarantine', r'set "q_dir=%client_dir%\Quarantine\TDSSKiller"', @@ -653,11 +568,9 @@ LAUNCHERS = { }, r'Uninstallers': { 'IObit Uninstaller': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'IObitUninstallerPortable', 'L_ITEM': 'IObitUninstallerPortable.exe', - 'L_CHCK': 'True', - 'L_NCMD': 'True', }, }, }