From a6d991ca604e69823a15cc133409f11d3dbe6c73 Mon Sep 17 00:00:00 2001 From: Alan Mason <1923621+2Shirt@users.noreply.github.com> Date: Wed, 22 Nov 2017 13:48:07 -0800 Subject: [PATCH 01/14] Reordered sections --- .bin/Scripts/Launch.cmd | 54 ++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/.bin/Scripts/Launch.cmd b/.bin/Scripts/Launch.cmd index efcc37f7..9a114ef8 100644 --- a/.bin/Scripts/Launch.cmd +++ b/.bin/Scripts/Launch.cmd @@ -165,33 +165,6 @@ if "%_odt%" == "True" ( ) 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 -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 - popd -) else ( - rem QuickBooks source not supported by this script - goto ErrorQuickBooksUnsupported -) -goto Exit - :LaunchProgram rem Test L_PATH and set %_path% call :TestPath || goto ErrorProgramNotFound @@ -274,6 +247,33 @@ if defined L_ELEV ( ) 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 +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 + popd +) else ( + rem QuickBooks source not supported by this script + goto ErrorQuickBooksUnsupported +) +goto Exit + :Usage echo. echo.Usage (via defined variables): From 2b7e3f38fe904fda454fb509abcb563b6b9696f8 Mon Sep 17 00:00:00 2001 From: Alan Mason <1923621+2Shirt@users.noreply.github.com> Date: Wed, 22 Nov 2017 13:49:47 -0800 Subject: [PATCH 02/14] Simplified extraction code * BREAKING: No longer supports single-file archives. * All archives in .cbin are now extracted to their own folder. --- .bin/Scripts/Launch.cmd | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.bin/Scripts/Launch.cmd b/.bin/Scripts/Launch.cmd index 9a114ef8..1565346e 100644 --- a/.bin/Scripts/Launch.cmd +++ b/.bin/Scripts/Launch.cmd @@ -297,12 +297,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 From ec97e4deb34129a927a49d4a7dcda93abdf79167 Mon Sep 17 00:00:00 2001 From: Alan Mason <1923621+2Shirt@users.noreply.github.com> Date: Wed, 22 Nov 2017 13:51:13 -0800 Subject: [PATCH 03/14] ConEmu sections updated * Use a ConEmu variable instead of manually setting IN_CONEMU=True * USE_CONEMU renamed RELOAD_IN_CONEMU for clarity --- .bin/Scripts/Launch.cmd | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.bin/Scripts/Launch.cmd b/.bin/Scripts/Launch.cmd index 1565346e..5313eae9 100644 --- a/.bin/Scripts/Launch.cmd +++ b/.bin/Scripts/Launch.cmd @@ -66,17 +66,16 @@ if /i not "%L_NCMD%" == "True" (set "L_NCMD=") if /i not "%L_WAIT%" == "True" (set "L_WAIT=") :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%" == "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 ) @@ -424,7 +423,7 @@ 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 ( + if defined ConEmuBuild ( echo Press any key to exit... pause>nul ) From bd649f218918afb31160a23915780cc74cd8288d Mon Sep 17 00:00:00 2001 From: Alan Mason <1923621+2Shirt@users.noreply.github.com> Date: Wed, 22 Nov 2017 14:01:54 -0800 Subject: [PATCH 04/14] Split LaunchConsole into Native & ConEmu parts --- .bin/Scripts/Launch.cmd | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/.bin/Scripts/Launch.cmd b/.bin/Scripts/Launch.cmd index 5313eae9..ba9e8117 100644 --- a/.bin/Scripts/Launch.cmd +++ b/.bin/Scripts/Launch.cmd @@ -92,23 +92,37 @@ if /i "%L_TYPE%" == "PyScript" (goto LaunchPyScript) 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 + 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 program popd && pushd "%_path%" -rem Run program in console emulator %CON% and catch error(s) +if defined L_NCMD ( + goto LaunchConsoleNative +) else ( + goto LaunchConsoleConEmu +) + +:LaunchConsoleConEmu +rem 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") + start "" "%CON%" -run "%prog%" %L_ARGS% %con_args% || goto ErrorUnknown goto Exit +:LaunchConsoleNative +start "" /wait "%prog%" %L_ARGS% || goto ErrorUnknown +goto Exit + :LaunchFolder rem Test L_PATH and set %_path% (extracts archive in necessary) call :TestPath || goto ErrorProgramNotFound From c526c3d1b9a641af92a1ed9242a80c3d85cdd52f Mon Sep 17 00:00:00 2001 From: Alan Mason <1923621+2Shirt@users.noreply.github.com> Date: Wed, 22 Nov 2017 14:36:41 -0800 Subject: [PATCH 05/14] Split Program and Office sections * Also renamed TestPath for clarity --- .bin/Scripts/Launch.cmd | 177 +++++++++++++++++++++++++--------------- 1 file changed, 109 insertions(+), 68 deletions(-) diff --git a/.bin/Scripts/Launch.cmd b/.bin/Scripts/Launch.cmd index ba9e8117..44329f6d 100644 --- a/.bin/Scripts/Launch.cmd +++ b/.bin/Scripts/Launch.cmd @@ -84,7 +84,7 @@ if defined RELOAD_IN_CONEMU ( 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%" == "Office" (goto LaunchOffice) if /i "%L_TYPE%" == "QuickBooks" (goto LaunchQuickBooksSetup) if /i "%L_TYPE%" == "Program" (goto LaunchProgram) if /i "%L_TYPE%" == "PSScript" (goto LaunchPSScript) @@ -92,8 +92,8 @@ if /i "%L_TYPE%" == "PyScript" (goto LaunchPyScript) goto Usage :LaunchConsole -rem Test L_PATH and set %_path% -call :TestPath || goto ErrorProgramNotFound +rem Prep +call :ExtractOrFindPath || goto ErrorProgramNotFound rem Check for 64-bit prog (if running on 64-bit system) set "prog=%_path%\%L_ITEM%" @@ -111,103 +111,140 @@ if defined L_NCMD ( ) :LaunchConsoleConEmu -rem Set args +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 :LaunchConsoleNative -start "" /wait "%prog%" %L_ARGS% || goto ErrorUnknown +rem Prep +if defined L_WAIT (set "wait=/wait") + +rem Run +start "" %wait% "%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 + +: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=\\%OFFICE_SERVER%\Office\!product!" +set "dest=%client_dir%\Office" + +rem Verify +if not exist "!source!" (goto ErrorOfficeSourceNotFound) + +rem Copy +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 :LaunchProgram -rem Test L_PATH and set %_path% -call :TestPath || goto ErrorProgramNotFound +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 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 + goto LaunchProgramElev ) else ( - if defined L_WAIT (set "wait=/wait") - start "" %wait% "%prog%" %L_ARGS% || goto ErrorUnknown + goto LaunchProgramUser ) + +:LaunchProgramElev +rem Prep +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" + +rem Run (via VB script) +"%systemroot%\System32\cscript.exe" //nologo "%bin%\tmp\Elevate.vbs" || goto ErrorUnknown +goto Exit + +:LaunchProgramUser +rem Prep +if defined L_WAIT (set "wait=/wait") + +rem Run +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 +rem Prep +call :ExtractOrFindPath || goto ErrorProgramNotFound set "script=%_path%\%L_ITEM%" set "ps_args=-ExecutionPolicy Bypass -NoProfile" if not exist "%script%" goto ErrorScriptNotFound @@ -233,9 +270,8 @@ if defined L_ELEV ( 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 Prep +call :ExtractOrFindPath || goto ErrorProgramNotFound rem Set args set "script=%_path%\%L_ITEM%" if not exist "%script%" goto ErrorScriptNotFound @@ -347,12 +383,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 @@ -376,6 +412,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. From 00e0ff5e2d22b24198c7dbd197a8c7bbdb6d2f8b Mon Sep 17 00:00:00 2001 From: Alan Mason <1923621+2Shirt@users.noreply.github.com> Date: Wed, 22 Nov 2017 14:42:49 -0800 Subject: [PATCH 06/14] Split PSScript section --- .bin/Scripts/Launch.cmd | 54 ++++++++++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 17 deletions(-) diff --git a/.bin/Scripts/Launch.cmd b/.bin/Scripts/Launch.cmd index 44329f6d..ff06c277 100644 --- a/.bin/Scripts/Launch.cmd +++ b/.bin/Scripts/Launch.cmd @@ -246,26 +246,46 @@ goto Exit 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 ( - 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 + goto LaunchPSScriptElev ) 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 LaunchPSScriptUser +) + +:LaunchPSScriptElev +rem Prep +call :DeQuote script +set "ps_args=-ExecutionPolicy Bypass -NoProfile" + +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" +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 Prep +set "ps_args=-ExecutionPolicy Bypass -NoProfile" + +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 From 88bb009cf2757c6637a3e6e4f4aae3993bd032b7 Mon Sep 17 00:00:00 2001 From: Alan Mason <1923621+2Shirt@users.noreply.github.com> Date: Wed, 22 Nov 2017 14:50:55 -0800 Subject: [PATCH 07/14] Split PyScript and some cleanup --- .bin/Scripts/Launch.cmd | 58 ++++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 24 deletions(-) diff --git a/.bin/Scripts/Launch.cmd b/.bin/Scripts/Launch.cmd index ff06c277..c77c604e 100644 --- a/.bin/Scripts/Launch.cmd +++ b/.bin/Scripts/Launch.cmd @@ -225,12 +225,12 @@ rem Prep call :DeQuote prog call :DeQuote L_ARGS -rem Create a temporary VB script to elevate the specified program +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 (via VB script) +rem Run "%systemroot%\System32\cscript.exe" //nologo "%bin%\tmp\Elevate.vbs" || goto ErrorUnknown goto Exit @@ -246,6 +246,7 @@ goto Exit 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 @@ -261,9 +262,8 @@ if defined L_ELEV ( :LaunchPSScriptElev rem Prep call :DeQuote script -set "ps_args=-ExecutionPolicy Bypass -NoProfile" -rem Create a temporary VB script to elevate the specified program +rem Create VB script mkdir "%bin%\tmp" 2>nul echo Set UAC = CreateObject^("Shell.Application"^) > "%bin%\tmp\Elevate.vbs" if defined L_NCMD ( @@ -278,9 +278,6 @@ rem Run goto Exit :LaunchPSScriptUser -rem Prep -set "ps_args=-ExecutionPolicy Bypass -NoProfile" - rem Run if defined L_NCMD ( start "" "%POWERSHELL%" %ps_args% -File "%script%" || goto ErrorUnknown @@ -292,27 +289,40 @@ goto Exit :LaunchPyScript rem Prep call :ExtractOrFindPath || goto ErrorProgramNotFound -rem Set args set "script=%_path%\%L_ITEM%" + +rem Verify if not exist "%script%" goto ErrorScriptNotFound + +rem Run 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 + goto LaunchPyScriptElev ) else ( - if defined L_NCMD ( - start "" "%PYTHON%" "%script%" || goto ErrorUnknown - ) else ( - start "" "%CON%" -run "%PYTHON%" "%script%" -new_console:n || goto ErrorUnknown - ) + 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 From b60244a2f96d299c8cf3b098785568d42d88d017 Mon Sep 17 00:00:00 2001 From: Alan Mason <1923621+2Shirt@users.noreply.github.com> Date: Wed, 22 Nov 2017 15:01:02 -0800 Subject: [PATCH 08/14] LaunchOffice cleanup --- .bin/Scripts/Launch.cmd | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/.bin/Scripts/Launch.cmd b/.bin/Scripts/Launch.cmd index c77c604e..1770c503 100644 --- a/.bin/Scripts/Launch.cmd +++ b/.bin/Scripts/Launch.cmd @@ -175,26 +175,27 @@ goto Exit :LaunchOfficeSetup rem Prep +echo Copying setup file(s) for %L_ITEM%... 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 "source=\\%OFFICE_SERVER%\Office\%product%" set "dest=%client_dir%\Office" rem Verify -if not exist "!source!" (goto ErrorOfficeSourceNotFound) +if not exist "%source%" (goto ErrorOfficeSourceNotFound) rem Copy -start "" /wait "%FASTCOPY%" !fastcopy_args! "!source!" /to="!dest!\" +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 +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 From dbcaa54f5f1d0136cefce57cb8cac86360047975 Mon Sep 17 00:00:00 2001 From: Alan Mason <1923621+2Shirt@users.noreply.github.com> Date: Wed, 22 Nov 2017 15:01:15 -0800 Subject: [PATCH 09/14] QuickBooks split --- .bin/Scripts/Launch.cmd | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/.bin/Scripts/Launch.cmd b/.bin/Scripts/Launch.cmd index 1770c503..07684f34 100644 --- a/.bin/Scripts/Launch.cmd +++ b/.bin/Scripts/Launch.cmd @@ -328,25 +328,26 @@ if defined L_NCMD ( 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 +rem Prep call "%bin%\Scripts\init_client_dir.cmd" /QuickBooks -echo Copying setup file(s) for %L_ITEM%... -rem copy setup files from QUICKBOOKS_SERVER_IP 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=\\%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 From aef692dddfe937a9e481874598de53ca3de8910c Mon Sep 17 00:00:00 2001 From: Alan Mason <1923621+2Shirt@users.noreply.github.com> Date: Wed, 22 Nov 2017 15:29:14 -0800 Subject: [PATCH 10/14] Removed unused L_CHCK and L_WAIT variables --- .bin/Scripts/Launch.cmd | 37 ++++++------------ .bin/Scripts/Launcher_Template.cmd | 20 +--------- .bin/Scripts/settings/launchers.py | 62 ------------------------------ 3 files changed, 12 insertions(+), 107 deletions(-) diff --git a/.bin/Scripts/Launch.cmd b/.bin/Scripts/Launch.cmd index 07684f34..5e1eb4b1 100644 --- a/.bin/Scripts/Launch.cmd +++ b/.bin/Scripts/Launch.cmd @@ -60,10 +60,8 @@ 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 set RELOAD_IN_CONEMU=True @@ -121,11 +119,8 @@ start "" "%CON%" -run "%prog%" %L_ARGS% %con_args% || goto ErrorUnknown goto Exit :LaunchConsoleNative -rem Prep -if defined L_WAIT (set "wait=/wait") - rem Run -start "" %wait% "%prog%" %L_ARGS% || goto ErrorUnknown +start "" "%prog%" %L_ARGS% || goto ErrorUnknown goto Exit :LaunchFolder @@ -236,11 +231,8 @@ rem Run goto Exit :LaunchProgramUser -rem Prep -if defined L_WAIT (set "wait=/wait") - rem Run -start "" %wait% "%prog%" %L_ARGS% || goto ErrorUnknown +start "" "%prog%" %L_ARGS% || goto ErrorUnknown goto Exit :LaunchPSScript @@ -359,13 +351,13 @@ goto Exit 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. Console Working Dir Program Args [L_ELEV] [L_NCMD] +echo. Folder Folder '.' [L_NCMD] +echo. Office Year Product [L_NCMD] +echo. QuickBooks Year Product [L_NCMD] +echo. Program Working Dir Program Args [L_ELEV] [L_NCMD] +echo. PSScript Scripts Script [L_ELEV] [L_NCMD] +echo. PyScript Scripts Script [L_ELEV] [L_NCMD] echo. goto Abort @@ -501,20 +493,13 @@ 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 defined ConEmuBuild ( - echo Press any key to exit... - pause>nul - ) -) +echo Press any key to exit... +pause>nul color rem Set errorlevel to 1 by calling color incorrectly color 00 diff --git a/.bin/Scripts/Launcher_Template.cmd b/.bin/Scripts/Launcher_Template.cmd index c7078e1c..fed7542e 100644 --- a/.bin/Scripts/Launcher_Template.cmd +++ b/.bin/Scripts/Launcher_Template.cmd @@ -17,32 +17,14 @@ 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_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/settings/launchers.py b/.bin/Scripts/settings/launchers.py index b87e0322..946ce5b4 100644 --- a/.bin/Scripts/settings/launchers.py +++ b/.bin/Scripts/settings/launchers.py @@ -6,42 +6,36 @@ 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': { @@ -49,14 +43,12 @@ LAUNCHERS = { 'L_TYPE': 'Console', 'L_PATH': 'TestDisk', 'L_ITEM': 'photorec_win.exe', - 'L_CHCK': 'True', 'L_ELEV': 'True', }, 'PhotoRec': { 'L_TYPE': 'Program', 'L_PATH': 'TestDisk', 'L_ITEM': 'qphotorec_win.exe', - 'L_CHCK': 'True', 'L_ELEV': 'True', 'L_NCMD': 'True', }, @@ -64,7 +56,6 @@ LAUNCHERS = { 'L_TYPE': 'Console', 'L_PATH': 'TestDisk', 'L_ITEM': 'testdisk_win.exe', - 'L_CHCK': 'True', 'L_ELEV': 'True', }, }, @@ -112,7 +103,6 @@ LAUNCHERS = { r'Thumbs.db' r' /to=%client_dir%\Transfer_%iso_date%\ ' ), - 'L_CHCK': 'True', 'L_ELEV': 'True', 'L_NCMD': 'True', 'Extra Code': [ @@ -162,7 +152,6 @@ 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', @@ -179,7 +168,6 @@ LAUNCHERS = { r' -dontcryptsupportinfo' r' -fixednames' ), - 'L_CHCK': 'True', 'L_NCMD': 'True', 'Extra Code': [ r'call "%bin%\Scripts\init_client_dir.cmd" /Quarantine', @@ -191,14 +179,12 @@ 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)': { @@ -206,7 +192,6 @@ LAUNCHERS = { 'L_PATH': 'XYplorerFree', 'L_ITEM': 'XYplorerFree.exe', 'L_ARGS': r'/exp /win=max %userprofile%', - 'L_CHCK': 'True', 'L_ELEV': 'True', 'L_NCMD': 'True', }, @@ -215,7 +200,6 @@ LAUNCHERS = { 'L_PATH': 'XYplorerFree', 'L_ITEM': 'XYplorerFree.exe', 'L_ARGS': r'/exp /win=max %userprofile%', - 'L_CHCK': 'True', 'L_NCMD': 'True', }, }, @@ -224,7 +208,6 @@ LAUNCHERS = { 'L_TYPE': 'Program', 'L_PATH': 'HWiNFO', 'L_ITEM': 'HWiNFO.exe', - 'L_CHCK': 'True', 'L_NCMD': 'True', 'Extra Code': [ r'for %%a in (32 64) do (', @@ -238,7 +221,6 @@ LAUNCHERS = { 'L_TYPE': 'Program', 'L_PATH': 'ProduKey', 'L_ITEM': 'ProduKey.exe', - 'L_CHCK': 'True', 'L_ELEV': 'True', 'L_NCMD': 'True', 'Extra Code': [ @@ -254,7 +236,6 @@ LAUNCHERS = { 'L_TYPE': 'Program', 'L_PATH': 'AIDA64', 'L_ITEM': 'aida64.exe', - 'L_CHCK': 'True', 'L_NCMD': 'True', }, 'Autoruns (with VirusTotal Scan)': { @@ -262,7 +243,6 @@ LAUNCHERS = { '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', @@ -281,14 +261,12 @@ LAUNCHERS = { 'L_TYPE': 'Program', 'L_PATH': 'BleachBit', 'L_ITEM': 'bleachbit.exe', - 'L_CHCK': 'True', 'L_NCMD': 'True', }, 'BlueScreenView': { 'L_TYPE': 'Program', 'L_PATH': 'BlueScreenView', 'L_ITEM': 'BlueScreenView.exe', - 'L_CHCK': 'True', 'L_ELEV': 'True', 'L_NCMD': 'True', }, @@ -297,7 +275,6 @@ LAUNCHERS = { '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': [ @@ -308,7 +285,6 @@ LAUNCHERS = { 'L_TYPE': 'Program', 'L_PATH': 'HitmanPro', 'L_ITEM': 'HitmanPro.exe', - 'L_CHCK': 'True', 'L_NCMD': 'True', 'Extra Code': [ r'call "%bin%\Scripts\init_client_dir.cmd" /Info', @@ -318,7 +294,6 @@ LAUNCHERS = { 'L_TYPE': 'Program', 'L_PATH': 'HWiNFO', 'L_ITEM': 'HWiNFO.exe', - 'L_CHCK': 'True', 'L_NCMD': 'True', 'Extra Code': [ r'for %%a in (32 64) do (', @@ -335,35 +310,30 @@ LAUNCHERS = { '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_PATH': r'_Drivers\Intel SSD Toolbox', 'L_ITEM': 'Intel SSD Toolbox.exe', - 'L_CHCK': 'True', 'L_NCMD': 'True', }, 'Samsing Magician': { 'L_TYPE': 'Program', '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_PATH': '_Drivers\SDIO', 'L_ITEM': 'SDIO.exe', - 'L_CHCK': 'True', 'L_NCMD': 'True', }, }, @@ -372,7 +342,6 @@ LAUNCHERS = { 'L_TYPE': 'Program', 'L_PATH': 'HWiNFO', 'L_ITEM': 'HWiNFO.exe', - 'L_CHCK': 'True', 'L_NCMD': 'True', 'Extra Code': [ r'for %%a in (32 64) do (', @@ -387,7 +356,6 @@ LAUNCHERS = { 'L_TYPE': 'Program', 'L_PATH': 'HWiNFO', 'L_ITEM': 'HWiNFO.exe', - 'L_CHCK': 'True', 'L_NCMD': 'True', 'Extra Code': [ r'for %%a in (32 64) do (', @@ -402,7 +370,6 @@ LAUNCHERS = { 'L_TYPE': 'Program', 'L_PATH': 'HWiNFO', 'L_ITEM': 'HWiNFO.exe', - 'L_CHCK': 'True', 'L_NCMD': 'True', 'Extra Code': [ r'for %%a in (32 64) do (', @@ -419,7 +386,6 @@ LAUNCHERS = { 'L_TYPE': 'PyScript', 'L_PATH': 'Scripts', 'L_ITEM': 'install_sw_bundle.py', - 'L_CHCK': 'True', 'L_ELEV': 'True', }, }, @@ -428,25 +394,21 @@ LAUNCHERS = { 'L_TYPE': 'Office', 'L_PATH': '2013', 'L_ITEM': 'hb_32.xml', - 'L_CHCK': 'True', }, 'Home and Business 2013 (x64)': { 'L_TYPE': 'Office', 'L_PATH': '2013', 'L_ITEM': 'hb_64.xml', - 'L_CHCK': 'True', }, 'Home and Student 2013 (x32)': { 'L_TYPE': 'Office', 'L_PATH': '2013', 'L_ITEM': 'hs_32.xml', - 'L_CHCK': 'True', }, 'Home and Student 2013 (x64)': { 'L_TYPE': 'Office', 'L_PATH': '2013', 'L_ITEM': 'hs_64.xml', - 'L_CHCK': 'True', }, }, r'Installers\Extras\Office\2016': { @@ -454,37 +416,31 @@ LAUNCHERS = { 'L_TYPE': 'Office', 'L_PATH': '2016', 'L_ITEM': 'hb_32.xml', - 'L_CHCK': 'True', }, 'Home and Business 2016 (x64)': { 'L_TYPE': 'Office', 'L_PATH': '2016', 'L_ITEM': 'hb_64.xml', - 'L_CHCK': 'True', }, 'Home and Student 2016 (x32)': { 'L_TYPE': 'Office', 'L_PATH': '2016', 'L_ITEM': 'hs_32.xml', - 'L_CHCK': 'True', }, 'Home and Student 2016 (x64)': { 'L_TYPE': 'Office', 'L_PATH': '2016', 'L_ITEM': 'hs_64.xml', - 'L_CHCK': 'True', }, 'Office 365 2016 (x32)': { 'L_TYPE': 'Office', 'L_PATH': '2016', 'L_ITEM': '365_32.xml', - 'L_CHCK': 'True', }, 'Office 365 2016 (x64)': { 'L_TYPE': 'Office', 'L_PATH': '2016', 'L_ITEM': '365_64.xml', - 'L_CHCK': 'True', }, }, r'Misc': { @@ -492,7 +448,6 @@ LAUNCHERS = { 'L_TYPE': 'Program', 'L_PATH': 'ConEmu', 'L_ITEM': 'ConEmu.exe', - 'L_CHCK': 'True', 'L_ELEV': 'True', 'L_NCMD': 'True', }, @@ -500,7 +455,6 @@ LAUNCHERS = { 'L_TYPE': 'Program', 'L_PATH': 'ConEmu', 'L_ITEM': 'ConEmu.exe', - 'L_CHCK': 'True', 'L_NCMD': 'True', }, 'Everything': { @@ -508,7 +462,6 @@ LAUNCHERS = { 'L_PATH': 'Everything', 'L_ITEM': 'Everything.exe', 'L_ARGS': '-nodb', - 'L_CHCK': 'True', 'L_ELEV': 'True', 'L_NCMD': 'True', }, @@ -516,21 +469,18 @@ LAUNCHERS = { 'L_TYPE': 'Program', 'L_PATH': 'notepadplusplus', 'L_ITEM': 'notepadplusplus.exe', - 'L_CHCK': 'True', 'L_NCMD': 'True', }, 'PuTTY': { 'L_TYPE': 'Program', 'L_PATH': 'PuTTY', 'L_ITEM': 'PUTTY.EXE', - 'L_CHCK': 'True', 'L_NCMD': 'True', }, 'TreeSizeFree': { 'L_TYPE': 'Program', 'L_PATH': 'TreeSizeFree', 'L_ITEM': 'TreeSizeFree.exe', - 'L_CHCK': 'True', 'L_ELEV': 'True', 'L_NCMD': 'True', }, @@ -538,14 +488,12 @@ LAUNCHERS = { 'L_TYPE': 'PyScript', 'L_PATH': 'Scripts', 'L_ITEM': 'update_kit.py', - 'L_CHCK': 'True', }, 'XMPlay': { 'L_TYPE': 'Program', 'L_PATH': 'XMPlay', 'L_ITEM': 'xmplay.exe', 'L_ARGS': '"%bin%\XMPlay\music.7z"', - 'L_CHCK': 'True', 'L_NCMD': 'True', }, }, @@ -554,7 +502,6 @@ LAUNCHERS = { 'L_TYPE': 'Program', 'L_PATH': 'AdwCleaner', 'L_ITEM': 'AdwCleaner.exe', - 'L_CHCK': 'True', 'L_NCMD': 'True', }, 'Autoruns': { @@ -562,8 +509,6 @@ LAUNCHERS = { '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', @@ -582,14 +527,12 @@ 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', }, @@ -604,7 +547,6 @@ LAUNCHERS = { r' -dontcryptsupportinfo' r' -fixednames' ), - 'L_CHCK': 'True', 'L_NCMD': 'True', 'Extra Code': [ r'call "%bin%\Scripts\init_client_dir.cmd" /Quarantine', @@ -616,7 +558,6 @@ LAUNCHERS = { 'L_TYPE': 'Program', '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,7 +567,6 @@ LAUNCHERS = { 'L_TYPE': 'PyScript', 'L_PATH': 'Scripts', 'L_ITEM': 'sfc_scan.py', - 'L_CHCK': 'True', 'L_ELEV': 'True', 'L_NCMD': 'True', }, @@ -642,7 +582,6 @@ LAUNCHERS = { r' -dcexact' r' -tdlfs' ), - 'L_CHCK': 'True', 'L_NCMD': 'True', 'Extra Code': [ r'call "%bin%\Scripts\init_client_dir.cmd" /Quarantine', @@ -656,7 +595,6 @@ LAUNCHERS = { 'L_TYPE': 'Program', 'L_PATH': 'IObitUninstallerPortable', 'L_ITEM': 'IObitUninstallerPortable.exe', - 'L_CHCK': 'True', 'L_NCMD': 'True', }, }, From 19f744f8f86487e8bf5c6ac0af73dd2f00d4894c Mon Sep 17 00:00:00 2001 From: Alan Mason <1923621+2Shirt@users.noreply.github.com> Date: Wed, 22 Nov 2017 15:33:29 -0800 Subject: [PATCH 11/14] Avoid double pause in Launch.cmd If Launch.cmd aborted it would cause the launcher to abort as well. If the error was handled by Launch.cmd then we can assume the launcher ran correctly. --- .bin/Scripts/Launch.cmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.bin/Scripts/Launch.cmd b/.bin/Scripts/Launch.cmd index 5e1eb4b1..41678881 100644 --- a/.bin/Scripts/Launch.cmd +++ b/.bin/Scripts/Launch.cmd @@ -500,9 +500,9 @@ echo. DEBUG: %DEBUG% echo. PYTHON: %PYTHON% 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 :: From c4b768e1149b5f1064aa802c08bf1a5c70e6061e Mon Sep 17 00:00:00 2001 From: Alan Mason <1923621+2Shirt@users.noreply.github.com> Date: Wed, 22 Nov 2017 16:45:11 -0800 Subject: [PATCH 12/14] Merged Console and Program sections * BREAKING: This uses a new L_TYPE: Executable * Added new L__CLI variable to run inside ConEmu --- .bin/Scripts/Launch.cmd | 90 ++++++++------------- .bin/Scripts/Launcher_Template.cmd | 1 + .bin/Scripts/functions/update.py | 1 - .bin/Scripts/settings/launchers.py | 123 ++++++++++++----------------- 4 files changed, 85 insertions(+), 130 deletions(-) diff --git a/.bin/Scripts/Launch.cmd b/.bin/Scripts/Launch.cmd index 41678881..42daa84e 100644 --- a/.bin/Scripts/Launch.cmd +++ b/.bin/Scripts/Launch.cmd @@ -62,13 +62,15 @@ if not defined L_ITEM (goto Usage) rem Assume if not "True" then False (i.e. undefine variable) if /i not "%L_ELEV%" == "True" (set "L_ELEV=") if /i not "%L_NCMD%" == "True" (set "L_NCMD=") +if /i not "%L__CLI%" == "True" (set "L__CLI=") :RelaunchInConEmu set RELOAD_IN_CONEMU=True -if defined ConEmuBuild set "RELOAD_IN_CONEMU=" -if defined L_NCMD set "RELOAD_IN_CONEMU=" -if "%L_TYPE%" == "PSScript" set "RELOAD_IN_CONEMU=" -if "%L_TYPE%" == "PyScript" set "RELOAD_IN_CONEMU=" +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 RELOAD_IN_CONEMU ( set "con_args=-new_console:n" @@ -80,16 +82,15 @@ if defined RELOAD_IN_CONEMU ( :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 LaunchOffice) -if /i "%L_TYPE%" == "QuickBooks" (goto LaunchQuickBooksSetup) -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%" == "QuickBooks" (goto LaunchQuickBooksSetup) goto Usage -:LaunchConsole +:LaunchExecutable rem Prep call :ExtractOrFindPath || goto ErrorProgramNotFound @@ -100,15 +101,16 @@ if %ARCH% equ 64 ( ) if not exist "%prog%" goto ErrorProgramNotFound -rem Run program +rem Run popd && pushd "%_path%" -if defined L_NCMD ( - goto LaunchConsoleNative +if defined L__CLI goto LaunchExecutableCLI +if defined L_ELEV ( + goto LaunchExecutableElev ) else ( - goto LaunchConsoleConEmu + goto LaunchExecutableUser ) -:LaunchConsoleConEmu +:LaunchExecutableCLI rem Prep set "con_args=-new_console:n" if defined DEBUG (set "con_args=%con_args% -new_console:c") @@ -118,7 +120,21 @@ rem Run start "" "%CON%" -run "%prog%" %L_ARGS% %con_args% || goto ErrorUnknown goto Exit -:LaunchConsoleNative +: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 @@ -197,44 +213,6 @@ if exist "%dest%\%product_name%\setup.exe" ( ) goto Exit -:LaunchProgram -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%" -if defined L_ELEV ( - goto LaunchProgramElev -) else ( - goto LaunchProgramUser -) - -:LaunchProgramElev -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 - -:LaunchProgramUser -rem Run -start "" "%prog%" %L_ARGS% || goto ErrorUnknown -goto Exit - :LaunchPSScript rem Prep call :ExtractOrFindPath || goto ErrorProgramNotFound @@ -482,10 +460,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. @@ -493,8 +471,10 @@ echo DETAILS: L_TYPE: %L_TYPE% echo. L_PATH: %L_PATH% echo. L_ITEM: %L_ITEM% echo. L_ARGS: %L_ARGS% +echo. L_7ZIP: %L_7ZIP% echo. L_ELEV: %L_ELEV% echo. L_NCMD: %L_NCMD% +echo. L__CLI: %L__CLI% echo. CON: %CON% echo. DEBUG: %DEBUG% echo. PYTHON: %PYTHON% diff --git a/.bin/Scripts/Launcher_Template.cmd b/.bin/Scripts/Launcher_Template.cmd index fed7542e..d5b68d9b 100644 --- a/.bin/Scripts/Launcher_Template.cmd +++ b/.bin/Scripts/Launcher_Template.cmd @@ -22,6 +22,7 @@ set L_TYPE= set L_PATH= set L_ITEM= set L_ARGS= +set L__CLI= set L_7ZIP= set L_ELEV= set L_NCMD= diff --git a/.bin/Scripts/functions/update.py b/.bin/Scripts/functions/update.py index 388611c6..16f2d8f0 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 946ce5b4..46e8c9d3 100644 --- a/.bin/Scripts/settings/launchers.py +++ b/.bin/Scripts/settings/launchers.py @@ -40,28 +40,29 @@ LAUNCHERS = { }, r'Data Recovery': { 'PhotoRec (CLI)': { - 'L_TYPE': 'Console', + 'L_TYPE': 'Executable', 'L_PATH': 'TestDisk', 'L_ITEM': 'photorec_win.exe', 'L_ELEV': 'True', + 'L__CLI': 'True', }, 'PhotoRec': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'TestDisk', 'L_ITEM': 'qphotorec_win.exe', 'L_ELEV': 'True', - 'L_NCMD': 'True', }, 'TestDisk': { - 'L_TYPE': 'Console', + 'L_TYPE': 'Executable', 'L_PATH': 'TestDisk', 'L_ITEM': 'testdisk_win.exe', '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': ( @@ -104,13 +105,12 @@ LAUNCHERS = { r' /to=%client_dir%\Transfer_%iso_date%\ ' ), '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': ( @@ -152,13 +152,12 @@ LAUNCHERS = { r'Thumbs.db' r' /to=%client_dir%\Transfer_%iso_date%\ ' ), - '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': ( @@ -168,7 +167,6 @@ LAUNCHERS = { r' -dontcryptsupportinfo' r' -fixednames' ), - 'L_NCMD': 'True', 'Extra Code': [ r'call "%bin%\Scripts\init_client_dir.cmd" /Quarantine', r'set "q_dir=%client_dir%\Quarantine\KVRT"', @@ -188,27 +186,24 @@ LAUNCHERS = { '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_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_NCMD': 'True', }, }, r'Diagnostics': { 'HWiNFO': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'HWiNFO', 'L_ITEM': 'HWiNFO.exe', - 'L_NCMD': 'True', 'Extra Code': [ r'for %%a in (32 64) do (', r' copy /y "%bin%\HWiNFO\general.ini" "%bin%\HWiNFO\HWiNFO%%a.ini"', @@ -218,11 +213,10 @@ LAUNCHERS = { ], }, 'ProduKey': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'ProduKey', 'L_ITEM': 'ProduKey.exe', 'L_ELEV': 'True', - 'L_NCMD': 'True', 'Extra Code': [ r'if exist "%bin%\ProduKey" (', r' del "%bin%\ProduKey\ProduKey.cfg" 2>nul', @@ -233,17 +227,15 @@ LAUNCHERS = { }, r'Diagnostics\Extras': { 'AIDA64': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'AIDA64', 'L_ITEM': 'aida64.exe', - 'L_NCMD': 'True', }, 'Autoruns (with VirusTotal Scan)': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'Autoruns', 'L_ITEM': 'Autoruns.exe', 'L_ARGS': '-e', - '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', @@ -258,43 +250,38 @@ LAUNCHERS = { ], }, 'BleachBit': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'BleachBit', 'L_ITEM': 'bleachbit.exe', - 'L_NCMD': 'True', }, 'BlueScreenView': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'BlueScreenView', 'L_ITEM': 'BlueScreenView.exe', '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_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_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_NCMD': 'True', 'Extra Code': [ r'for %%a in (32 64) do (', r' copy /y "%bin%\HWiNFO\general.ini" "%bin%\HWiNFO\HWiNFO%%a.ini"', @@ -306,11 +293,10 @@ 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_NCMD': 'True', }, 'Intel RST (Previous Releases)': { 'L_TYPE': 'Folder', @@ -319,30 +305,26 @@ LAUNCHERS = { '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_NCMD': 'True', }, 'Samsing Magician': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': r'_Drivers\Samsung Magician', 'L_ITEM': 'Samsung Magician.exe', - 'L_NCMD': 'True', }, 'Snappy Driver Installer Origin': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': '_Drivers\SDIO', 'L_ITEM': 'SDIO.exe', - 'L_NCMD': 'True', }, }, r'Drivers\Extras': { 'Acer': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'HWiNFO', 'L_ITEM': 'HWiNFO.exe', - 'L_NCMD': 'True', 'Extra Code': [ r'for %%a in (32 64) do (', r' copy /y "%bin%\HWiNFO\general.ini" "%bin%\HWiNFO\HWiNFO%%a.ini"', @@ -353,10 +335,9 @@ LAUNCHERS = { ], }, 'Lenovo': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'HWiNFO', 'L_ITEM': 'HWiNFO.exe', - 'L_NCMD': 'True', 'Extra Code': [ r'for %%a in (32 64) do (', r' copy /y "%bin%\HWiNFO\general.ini" "%bin%\HWiNFO\HWiNFO%%a.ini"', @@ -367,10 +348,9 @@ LAUNCHERS = { ], }, 'Toshiba': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'HWiNFO', 'L_ITEM': 'HWiNFO.exe', - 'L_NCMD': 'True', 'Extra Code': [ r'for %%a in (32 64) do (', r' copy /y "%bin%\HWiNFO\general.ini" "%bin%\HWiNFO\HWiNFO%%a.ini"', @@ -394,21 +374,25 @@ LAUNCHERS = { 'L_TYPE': 'Office', 'L_PATH': '2013', 'L_ITEM': 'hb_32.xml', + 'L_NCMD': 'True', }, 'Home and Business 2013 (x64)': { 'L_TYPE': 'Office', 'L_PATH': '2013', 'L_ITEM': 'hb_64.xml', + 'L_NCMD': 'True', }, 'Home and Student 2013 (x32)': { 'L_TYPE': 'Office', 'L_PATH': '2013', 'L_ITEM': 'hs_32.xml', + 'L_NCMD': 'True', }, 'Home and Student 2013 (x64)': { 'L_TYPE': 'Office', 'L_PATH': '2013', 'L_ITEM': 'hs_64.xml', + 'L_NCMD': 'True', }, }, r'Installers\Extras\Office\2016': { @@ -416,73 +400,73 @@ LAUNCHERS = { 'L_TYPE': 'Office', 'L_PATH': '2016', 'L_ITEM': 'hb_32.xml', + 'L_NCMD': 'True', }, 'Home and Business 2016 (x64)': { 'L_TYPE': 'Office', 'L_PATH': '2016', 'L_ITEM': 'hb_64.xml', + 'L_NCMD': 'True', }, 'Home and Student 2016 (x32)': { 'L_TYPE': 'Office', 'L_PATH': '2016', 'L_ITEM': 'hs_32.xml', + 'L_NCMD': 'True', }, 'Home and Student 2016 (x64)': { 'L_TYPE': 'Office', 'L_PATH': '2016', 'L_ITEM': 'hs_64.xml', + 'L_NCMD': 'True', }, 'Office 365 2016 (x32)': { 'L_TYPE': 'Office', 'L_PATH': '2016', 'L_ITEM': '365_32.xml', + 'L_NCMD': 'True', }, 'Office 365 2016 (x64)': { 'L_TYPE': 'Office', 'L_PATH': '2016', 'L_ITEM': '365_64.xml', + 'L_NCMD': 'True', }, }, r'Misc': { 'ConEmu (as ADMIN)': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'ConEmu', 'L_ITEM': 'ConEmu.exe', 'L_ELEV': 'True', - 'L_NCMD': 'True', }, 'ConEmu': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'ConEmu', 'L_ITEM': 'ConEmu.exe', - 'L_NCMD': 'True', }, 'Everything': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'Everything', 'L_ITEM': 'Everything.exe', 'L_ARGS': '-nodb', 'L_ELEV': 'True', - 'L_NCMD': 'True', }, 'Notepad++': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'notepadplusplus', 'L_ITEM': 'notepadplusplus.exe', - 'L_NCMD': 'True', }, 'PuTTY': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'PuTTY', 'L_ITEM': 'PUTTY.EXE', - 'L_NCMD': 'True', }, 'TreeSizeFree': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'TreeSizeFree', 'L_ITEM': 'TreeSizeFree.exe', 'L_ELEV': 'True', - 'L_NCMD': 'True', }, 'Update Kit': { 'L_TYPE': 'PyScript', @@ -490,26 +474,23 @@ LAUNCHERS = { 'L_ITEM': 'update_kit.py', }, 'XMPlay': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'XMPlay', 'L_ITEM': 'xmplay.exe', 'L_ARGS': '"%bin%\XMPlay\music.7z"', - 'L_NCMD': 'True', }, }, r'Repairs': { 'AdwCleaner': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'AdwCleaner', 'L_ITEM': 'AdwCleaner.exe', - 'L_NCMD': 'True', }, 'Autoruns': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'Autoruns', 'L_ITEM': 'Autoruns.exe', 'L_ARGS': '-e', - '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', @@ -534,10 +515,9 @@ LAUNCHERS = { 'L_PATH': 'Scripts', 'L_ITEM': 'dism.py', 'L_ELEV': 'True', - 'L_NCMD': 'TRUE', }, 'KVRT': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'KVRT', 'L_ITEM': 'KVRT.exe', 'L_ARGS': ( @@ -547,7 +527,6 @@ LAUNCHERS = { r' -dontcryptsupportinfo' r' -fixednames' ), - 'L_NCMD': 'True', 'Extra Code': [ r'call "%bin%\Scripts\init_client_dir.cmd" /Quarantine', r'set "q_dir=%client_dir%\Quarantine\KVRT"', @@ -555,10 +534,9 @@ LAUNCHERS = { ], }, 'RKill': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'RKill', 'L_ITEM': 'RKill.exe', - 'L_NCMD': 'True', 'Extra Code': [ r'call "%bin%\Scripts\init_client_dir.cmd" /Info', ], @@ -568,10 +546,9 @@ LAUNCHERS = { 'L_PATH': 'Scripts', 'L_ITEM': 'sfc_scan.py', 'L_ELEV': 'True', - 'L_NCMD': 'True', }, 'TDSSKiller': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'TDSSKiller', 'L_ITEM': 'TDSSKiller.exe', 'L_ARGS': ( @@ -582,7 +559,6 @@ LAUNCHERS = { r' -dcexact' r' -tdlfs' ), - 'L_NCMD': 'True', 'Extra Code': [ r'call "%bin%\Scripts\init_client_dir.cmd" /Quarantine', r'set "q_dir=%client_dir%\Quarantine\TDSSKiller"', @@ -592,10 +568,9 @@ LAUNCHERS = { }, r'Uninstallers': { 'IObit Uninstaller': { - 'L_TYPE': 'Program', + 'L_TYPE': 'Executable', 'L_PATH': 'IObitUninstallerPortable', 'L_ITEM': 'IObitUninstallerPortable.exe', - 'L_NCMD': 'True', }, }, } From 48e4e70155a1f64819b5528f142119e5a48f35ee Mon Sep 17 00:00:00 2001 From: Alan Mason <1923621+2Shirt@users.noreply.github.com> Date: Wed, 22 Nov 2017 16:46:14 -0800 Subject: [PATCH 13/14] Updated usage message --- .bin/Scripts/Launch.cmd | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/.bin/Scripts/Launch.cmd b/.bin/Scripts/Launch.cmd index 42daa84e..e684c896 100644 --- a/.bin/Scripts/Launch.cmd +++ b/.bin/Scripts/Launch.cmd @@ -329,13 +329,17 @@ goto Exit echo. echo.Usage (via defined variables): echo. L_TYPE L_PATH L_ITEM L_ARGS -echo. Console Working Dir Program Args [L_ELEV] [L_NCMD] -echo. Folder Folder '.' [L_NCMD] -echo. Office Year Product [L_NCMD] -echo. QuickBooks Year Product [L_NCMD] -echo. Program Working Dir Program Args [L_ELEV] [L_NCMD] -echo. PSScript Scripts Script [L_ELEV] [L_NCMD] -echo. PyScript Scripts Script [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 From 1c0b8b6b19eb66f1545dd7ddc43bcb07eb4eb9be Mon Sep 17 00:00:00 2001 From: Alan Mason <1923621+2Shirt@users.noreply.github.com> Date: Wed, 22 Nov 2017 19:05:55 -0800 Subject: [PATCH 14/14] Bugfix: LaunchOfficeSetup * Forgot to update %OFFICE_SERVER% to %OFFICE_SERVER_IP% --- .bin/Scripts/Launch.cmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.bin/Scripts/Launch.cmd b/.bin/Scripts/Launch.cmd index e684c896..fd72d374 100644 --- a/.bin/Scripts/Launch.cmd +++ b/.bin/Scripts/Launch.cmd @@ -186,18 +186,18 @@ goto Exit :LaunchOfficeSetup rem Prep -echo Copying setup file(s) for %L_ITEM%... 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 "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