WizardKit/.bin/Scripts/init_client_dir.cmd
Alan Mason 6fc04266d4 2017-11: Retroactive Updates
## MAJOR refactoring done ##

* All .cmd Command scripts
  * Brandind / Settings variables now set via .bin/Scripts/settings/main.py
  * Window titles now set using KIT_FULL_NAME

* All .py Python scripts
  * All ClientDir paths should now use KIT_SHORT_NAME
  * Long lines wrapped to better follow PEP8
  * String formatting now more consistant
  * Updated run_program() and popen_program() calls to use lists
    * (e.g. cmd = ['', '', '']; run_program(cmd))
    ** Should improve clarity IMO
  * Update window titles AFTER init_global_vars() so KIT_FULL_NAME can be used

* Branding / Settings
  * Support tech now configurable
    * (e.g. "Please let {tech} know and they'll look into it")
  * Timezone now configurable
  * Upload info can now be disabled/enabled in .bin/Scripts/settings/main.py

* CHKDSK
  * Combined read-only and fix scripts and added menu

* DISM
  * Combined ScanHealth and RestoreHealth scripts and added menu

* functions/common.py
  * BREAKING: run_program() and popen_program() no longer accept 'args' variable

* Misc
  * Removed Win7 NVMe launcher
    * Never used and Win7 is deprecated
  * Removed "DeviceRemover" and "Display Driver Uninstaller" launchers
    * Both cut too deep and were not useful
  * Removed Nirsoft utilities and Sysinternals Suite launchers
    * Too many tools unused.
    * Added .url links to the websites in case the tools are needed
  * Replaced WinDirStat with TreeSizeFree
  * Replaced Q-Dir launcher with XYplorer launcher
    * Q-Dir was running into issues on Windows 10
  * Removed C.IntRep, ESET, and MBAM launchers from "OSR & VR"
  * Removed JRT
    * Deprecated and discontinued by MBAM
  * Removed unsupported QuickBooks launchers (2014 and older)
  * Removed unsupported Office launchers (2010 and 2013\365)
  * Removed "Revo Uninstaller" launcher
  * Removed infrequently used tools from "Diagnostics"
    * Auslogics DiskDefrag
    * BatteryInfoView
    * BIOSCodes
    * GpuTest
    * HeavyLoad

* Bugfixes
  * major_exception() try-blocks should catch CTL+c again
    * Allows for manual script bailing
2017-11-17 01:02:24 -07:00

78 lines
2 KiB
Batchfile

:: Wizard Kit: Create client_dir folder(s)
@echo off
if defined DEBUG (@echo on)
:SafetyCheck
if not defined bin (goto Abort)
:Init
set "SETTINGS=%bin%\Scripts\settings\main.py"
for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_SHORT %SETTINGS%`) do (
set "_v=%%f"
set "_v=!_v:*'=!"
set "KIT_NAME_SHORT=!_v:~0,-1!"
)
set "client_dir=%systemdrive%\%KIT_NAME_SHORT%"
set "log_dir=%client_dir%\Info\%iso_date%"
:Flags
set _backups=
set _info=
set _office=
set _quarantine=
set _quickbooks=
set _transfer=
for %%f in (%*) do (
if /i "%%f" == "/DEBUG" (@echo on)
if /i "%%f" == "/Backups" set _backups=True
if /i "%%f" == "/Info" set _info=True
if /i "%%f" == "/Office" set _office=True
if /i "%%f" == "/Quarantine" set _quarantine=True
if /i "%%f" == "/QuickBooks" set _quickbooks=True
if /i "%%f" == "/Transfer" set _transfer=True
)
:GetDate
:: Credit to SS64.com Code taken from http://ss64.com/nt/syntax-getdate.html
:: Use WMIC to retrieve date and time in ISO 8601 format.
for /f "skip=1 tokens=1-6" %%G in ('WMIC Path Win32_LocalTime Get Day^,Hour^,Minute^,Month^,Second^,Year /Format:table') do (
if "%%~L"=="" goto s_done
set _yyyy=%%L
set _mm=00%%J
set _dd=00%%G
set _hour=00%%H
set _minute=00%%I
)
:s_done
:: Pad digits with leading zeros
set _mm=%_mm:~-2%
set _dd=%_dd:~-2%
set _hour=%_hour:~-2%
set _minute=%_minute:~-2%
set iso_date=%_yyyy%-%_mm%-%_dd%
:CreateDirs
if defined _backups mkdir "%client_dir%\Backups">nul 2>&1
if defined _info mkdir "%client_dir%\Info">nul 2>&1
if defined _office mkdir "%client_dir%\Office">nul 2>&1
if defined _quarantine mkdir "%client_dir%\Quarantine">nul 2>&1
if defined _quickbooks mkdir "%client_dir%\QuickBooks">nul 2>&1
if defined _transfer mkdir "%client_dir%\Transfer_%iso_date%">nul 2>&1
goto Done
:Abort
color 4e
echo Aborted.
echo.
echo Press any key to exit...
pause>nul
color
rem Set errorlevel to 1 by calling color incorrectly
color 00
goto Exit
:Done
goto Exit
:Exit