@echo off goto :begin ::------------------------------------------------------------------------------------------------------------------------------------------------ :: File Name: "dddi.bat" - Device class Drivers DisInstaller / Inactive-Installer BATch for Windows 7 (OEM_SLP) / PE3.x :: :: Included: "dddi.bat" - Device class Drivers DisInstaller BATch for Windows 7 (OEM_SLP) / PE3.x - not UnInstaller :: Included: "ddii.bat" - Device class Drivers Inactive-Installer BATch for Windows 7 (OEM_SLP) / PE3.x - Cross-Installer, and not Self-Installer :: :: Copyright: Public Domain Software (NOT TO BE SHAREWARE OR FREEWARE) :: :: Version (??: secondary series; can be revised by somebodies) :: *.*?? by *** May be revised for something :: :: Version (ps: primary series; reserved for S. ) :: 0.1ps by S. Created to support removable external USB 2.0/3.0 Storage Devices (USB HDD/SSD/Memory etc.). :: :: ToDo: :: :: - The modified "inf" files should be generated automatically by this tool to support USB boot. :: - Enhanced Write Filter (EWF) should be supported. :: - This tool should be rewritten in other structured languages (by somebodies). This script code is not structured and is not optimized. :: :: Related Softwares (required): :: :: - Usb Boot Watcher: UsbBootWatcher (freeware, 32/64bit) :: http://www.911cd.net/forums//index.php?showtopic=22473#entry152574 :: Used: "(UsbBootWatcher\)x86\UsbBootWatcher.exe", "(UsbBootWatcher\)amd64\UsbBootWatcher.exe" :: :: Related Softwares (reference): :: :: - Multiple Boot Manager: MBM R0.39 (freeware) :: http://elm-chan.org/fsw/mbm/mbm_e.html :: http://elm-chan.org/fsw/mbm/mbm.html :: (elm-chan.org/fsw/mbm/mbm039.iso.gz) :: - Plop Boot Manager 5.0.14 (USB 3.0 supported) (freeware) :: http://www.plop.at/en/bootmanager/download.html :: :: - MiniTool Partition Wizard Home Edition 7.8 Full version (freeware, 32bit) :: http://www.partitionwizard.com/download.html :: - Gnome Partition Editor: GParted live 0.19.0-1 (freeware, 32/64bit) :: http://gparted.org/download.php :: :: - Paragon Backup & Recovery, version 10.1.21.287 (16.12.13) Free (freeware, 32/64bit) :: http://www.paragon-software.com/home/br-free/download.html :: - Paragon Rescue Kit Free Edition (2011-04-28 15:03:47) (freeware, 32bit) :: http://www.paragon-software.com/home/rk-express/download.html :: :: - XBoot 1.0 Beta 14 (freeware, 32bit) :: https://sites.google.com/site/shamurxboot/download :: :: - Ridgecrop Consultants fat32format 1.07? (GUI version) (freeware, 32/64bit) :: http://www.ridgecrop.demon.co.uk/index.htm?guiformat.htm :: - 2Tware Fat32Format 1.13 (freeware, 32bit) :: http://download.cnet.com/2Tware-Fat32Format/3000-2094_4-75623509.html :: :: - bpb: displays information about a drive and the BPB on the volume (freeware, 32bit) :: http://www.vector.co.jp/download/file/winnt/util/fh328130.html :: http://ftp.vector.co.jp/pack/winnt/util/disk/status/bpb.zip :: :: - PowerQuest Partition Table Editor (PTEDIT32.EXE) (freeware, 32bit) :: ftp://ftp.symantec.com/public/english_us_canada/tools/pq/utilities/PTEDIT32.zip :: - Acronis DiskEditor Demo version 6.0 (build 360) (freeware, 32bit) :: (www.acronis.com/en-us/files/diskeditor6.0_d_en.exe) :: Note: Check "Run as administrator" or "Run this program as an administrator" in Windows7 etc. :: :: - FastCopy v2.11 (freeware, 32/64bit) :: http://ipmsg.org/tools/fastcopy.html.en :: http://www.vector.co.jp/download/file/win95/util/fh581932.html :: http://www.vector.co.jp/download/file/win95/util/fh581931.html :: http://ftp.vector.co.jp/pack/win95/util/file/FastCopy211.zip :: http://ftp.vector.co.jp/pack/win95/util/file/FastCopy211_x64.zip :: :: - 7-Zip Portable 9.20 Rev 3 (freeware, 32bit) :: http://portableapps.com/apps/utilities/7-zip_portable :: :: - Windows Automated Installation Kit (AIK): WAIK for Windows 7 (freeware, 32/64bit) :: http://www.microsoft.com/en-us/download/details.aspx?id=5753 :: - Windows Automated Installation Kit (AIK): WAIK Supplement for Windows 7 SP1 (freeware, 32/64bit) :: http://www.microsoft.com/en-us/download/details.aspx?id=5188 :: :: Related Links (reference): :: :: - Goodells.Net :: Understanding MultiBooting :: http://www.goodells.net/multiboot/ptable.shtml :: - Using Disk Director to Change the Hidden Sectors field of an NTFS Logical Partition :: http://www.themudcrab.com/acronis_hiddensectors.php :: :: - Technical Details on Microsoft Product Activation for Windows XP :: http://technet.microsoft.com/en-us/library/bb457054.aspx#EFAA :: :: Notes :: - Structured Search Tags for log files - strings consists of the characters ";$#@*+=-/.>" :: ;;; : Layer-0 :: ;;$ : Layer-1 :: ;;# : Layer-2 :: ;;@ : Layer-3 :: ;;* : Layer-4 :: ;;+ : Layer-5 :: ;;= : Layer-6 :: ;;- : Layer-7 :: ;;/ : Crossed :: ;;. : Comment :: ;;> : Command (search ";;^>" in batch file) ::------------------------------------------------------------------------------------------------------------------------------------------------ :begin if .%1==.-h goto :usage if .%1==.--help goto :usage goto :exec :usage echo Preparations: echo Restore, copy or extract the target system to the destination partition. echo Extract dir/files from UsbBootWatcher.zip to the same directory as this tool. echo Download: http://www.911cd.net/forums//index.php?showtopic=22473#entry152574 echo. echo Usage: echo %~n0 [-h^|--help] [-d PART_DIS] [-i PART_INS] [rem] [^> %~n0.log] echo -h: display this help messages echo -d: DisInstall it from the source partition - not UnInstall echo -i: Inactive-Install it to the destination partition - Cross-Install echo rem: debug option to Inactive-Install ^(no real installation^) echo PART_DIS: source partition to DisInstall ^(C:,D:..^) echo PART_INS: destination partition to Inactive-Install ^(C:,D:..^) echo e.g. echo %~n0 ^> %~n0.log echo %~n0 -d d: ^> %~n0.log echo %~n0 -i e: ^>^> %~n0.log echo %~n0 -d d: -i e: ^> %~n0.log echo. echo with debug option to Inactive-Install ^(no real installation^) echo %~n0 -i e: rem ^>^> %~n0.log echo %~n0 -d d: -i e: rem ^> %~n0.log goto :eof :exec echo Please wait for several minutes patiently.>con setlocal enabledelayedexpansion set __DD= set __DK= set __DP= set __ID= set __IK= set __IP= set __WD=%SystemRoot:~3%\ if .%1==.-d ( if not "%~d2"=="" ( set __DD=%~d2\!__WD! if /I "%~d2"=="%SystemDrive%" ( set __DK=HKLM\SYSTEM\ set __DP=S_ ) else ( set __DK=HKLM\SYSTEM_X\ set __DP=X_ ) shift /1 shift /1 ) else ( echo. echo ;;/ Error: No source partition specified to DisInstall goto :abort ) ) if .%1==.-i ( if not "%~d2"=="" ( set __ID=%~d2\!__WD! if /I "%~d2"=="%SystemDrive%" ( set __IK=HKLM\SYSTEM\ set __IP=S_ ) else ( set __IK=HKLM\SYSTEM_X\ set __IP=X_ ) shift /1 shift /1 ) else ( echo. echo ;;/ Error: No destination partition specified to Inactive-Install goto :abort ) ) if not .%1==. if not .%1==.rem ( echo. echo ;;/ Error: Invalid arguments included goto :abort ) if "!__DD!"=="" if "!__ID!"=="" ( set __DD=%SystemRoot%\ set __DK=HKLM\SYSTEM\ set __DP=S_ ) if not "!__DD!"=="" echo ;;. DisInstall Dir.: "!__DD!" if not "!__DK!"=="" echo ;;. DisInstall Key: "!__DK!" if not "!__DP!"=="" echo ;;. DisInstall Pref.: "!__DP!" if not "!__WD!"=="" echo ;;. Working Dir.: "!__WD!" if not "!__ID!"=="" echo ;;. Install Dir.: "!__ID!" if not "!__IK!"=="" echo ;;. Install Key: "!__IK!" if not "!__IP!"=="" echo ;;. Install Pref.: "!__IP!" echo. :echo ;;. Info: Environment variables shown below - Summary of directories and keys :echo ;;^> set __ : set __ :echo. if "!__DD!"=="" goto :Inactive-Install if /I not "%CD%"=="%SystemDrive%\" ( if not exist "!__WD!inf.s32\" md "!__WD!inf.s32\" if not exist "!__WD!inf.rep\" md "!__WD!inf.rep\" if not exist "!__WD!inf.org\" md "!__WD!inf.org\" if not exist "!__WD!inf.mod\" md "!__WD!inf.mod\" if not exist "!__WD!system32\drivers\" md "!__WD!system32\drivers\" if not exist "!__WD!reg.org\Control\CriticalDeviceDatabase\" md "!__WD!reg.org\Control\CriticalDeviceDatabase\" if not exist "!__WD!reg.org\services\" md "!__WD!reg.org\services\" if not exist "!__WD!reg.org\_MountedDevices\" md "!__WD!reg.org\_MountedDevices\" if not exist "!__WD!reg.mod\Control\CriticalDeviceDatabase\" md "!__WD!reg.mod\Control\CriticalDeviceDatabase\" if not exist "!__WD!reg.mod\services\" md "!__WD!reg.mod\services\" if not exist "!__WD!reg.mod\_MountedDevices\" md "!__WD!reg.mod\_MountedDevices\" if not exist "!__WD!inf.mod\00README.TXT" ( echo This directory is reserved for the modified "inf" files and device drivers.> "!__WD!inf.mod\00README.TXT" ) if not exist "!__WD!inf.org\_EXCLUDE.TXT" ( echo .PNF> "!__WD!inf.org\_EXCLUDE.TXT" ) if exist "!__WD!inf.s32\" attrib +h "!__WD!inf.s32" if exist "!__WD!inf.rep\" attrib +h "!__WD!inf.rep" ) else ( echo. echo ;;/ Error: Can't make subdirectories to copy files on the directory "%CD%". goto :abort ) if /I "!__DK!"=="HKLM\SYSTEM_X\" ( set __DT=%DATE:/=%_%TIME::=% set __DT=!__DT: =0! set __DT=!__DT:.=_! if exist "!__DD!system32\config\SYSTEM_!__DT!" if exist "!__DD!system32\config\SYSTEM" ( echo ;;^> del "!__DD!system32\config\SYSTEM_!__DT!" del "!__DD!system32\config\SYSTEM_!__DT!" ) echo ;;^> ren "!__DD!system32\config\SYSTEM" "SYSTEM_!__DT!" ren "!__DD!system32\config\SYSTEM" "SYSTEM_!__DT!" echo ;;^> copy "!__DD!system32\config\SYSTEM_!__DT!" "!__DD!system32\config\SYSTEM" copy "!__DD!system32\config\SYSTEM_!__DT!" "!__DD!system32\config\SYSTEM" echo ;;^> reg load !__DK! "!__DD!system32\config\SYSTEM" reg load !__DK! "!__DD!system32\config\SYSTEM" echo. ) set _D_LLDClass= rem set _D_LLDClass=%_D_LLDClass% "IDE ATA/ATAPI controllers" set _D_LLDClass=%_D_LLDClass% "hdc" rem set _D_LLDClass=%_D_LLDClass% "Universal Serial Bus controllers" set _D_LLDClass=%_D_LLDClass% "USB" rem set _D_LLDClass=%_D_LLDClass% "Non-Plug and Play Drivers" rem set _D_LLDClass=%_D_LLDClass% "LegacyDriver" set _D_LLDClass=%_D_LLDClass:~1% echo ;;; List of Long or Device Class Name: ^(%_D_LLDClass%^) set _D_LSMatch= set _D_LSMatch=%_D_LSMatch% "ata" set _D_LSMatch=%_D_LSMatch% "ide" set _D_LSMatch=%_D_LSMatch% "stor" set _D_LSMatch=%_D_LSMatch% "usb" set _D_LSMatch=%_D_LSMatch:~1% echo. echo ;;; List of String to Match as Filenames: ^(%_D_LSMatch%^) set _D_Key=!__DK!Select set _D_KVD=Default : reg query "!_D_Key!" /s /f "!_D_KVD!" /k reg query "!_D_Key!" /v "!_D_KVD!" /s : reg query "!_D_Key!" /ve /s : reg query "!_D_Key!" /s /f "!_D_KVD!" /d set _D_SControlSet= set _D_LControlSet= for /F "usebackq skip=2 tokens=2* delims= " %%a in ( `reg query "!_D_Key!" /v "!_D_KVD!"` ) do ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" set /A _D_SControlSet=%%~b set _D_SControlSet=00!_D_SControlSet! set _D_SControlSet=ControlSet!_D_SControlSet:~-3! echo. echo ;;; Selected ControlSet: "!_D_SControlSet!" set _D_LControlSet="!_D_SControlSet!" rem set _D_LControlSet=!_D_LControlSet! "CurrentControlSet" echo. echo ;;; List of ControlSet: ^(!_D_LControlSet!^) ) set _D_ControlSet= for %%a in (%_D_LControlSet%) do ( set _D_ControlSet=%%~a echo. echo ;;$ ControlSet: "!_D_ControlSet!" set _D_Key=!__DK!!_D_ControlSet!\Control\Session Manager\Environment set _D_KVD=PROCESSOR_ARCHITECTURE rem reg query "!_D_Key!" /s /f "!_D_KVD!" /k rem reg query "!_D_Key!" /v "!_D_KVD!" /s rem reg query "!_D_Key!" /ve /s rem reg query "!_D_Key!" /s /f "!_D_KVD!" /d set _D_PROCESSOR_ARCHITECTURE= for /F "usebackq skip=2 tokens=2* delims= " %%a in ( `reg query "!_D_Key!" /v "!_D_KVD!"` ) do ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" set _D_PROCESSOR_ARCHITECTURE=%%~b echo. echo ;;$ Processor Architecture: %%~a "!_D_PROCESSOR_ARCHITECTURE!" ) set _D_LDClass= for %%a in (%_D_LLDClass%) do ( set _D_LDClass=%%~a echo. echo ;;# Long or Device Class Name: "!_D_LDClass!" set _D_Key=!__DK!!_D_ControlSet!\Control\Class set _D_KVD=!_D_LDClass! rem reg query "!_D_Key!" /s /f "!_D_KVD!" /k rem reg query "!_D_Key!" /v "!_D_KVD!" /s rem reg query "!_D_Key!" /ve /s rem reg query "!_D_Key!" /s /f "!_D_KVD!" /d reg query "!_D_Key!" /s /f "!_D_KVD!" /d /e set _D_DevCGUID= for /F "usebackq skip=1 tokens=6 delims=\" %%a in ( `reg query "!_D_Key!" /s /f "!_D_KVD!" /d /e ^&:` `reg query "!_D_Key!" /s /f "!_D_KVD!" /d` ) do ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" set _D_DevCGUID=%%~a echo. echo ;;# Device Class GUID: "!_D_DevCGUID!" ) rem Device Class GUID: {8ECC055D-047F-11D1-A537-0000F8753ED1} if /I "!_D_DevCGUID!"=="{8ECC055D-047F-11D1-A537-0000F8753ED1}" ( set _D_Key=!__DK!!_D_ControlSet!\Control\Class set _D_KVD=!_D_DevCGUID! ) else ( set _D_Key=!__DK!!_D_ControlSet!\Control\Class\!_D_DevCGUID! set _D_KVD=0* ) reg query "!_D_Key!" /s /f "!_D_KVD!" /k rem reg query "!_D_Key!" /v "!_D_KVD!" /s rem reg query "!_D_Key!" /ve /s rem reg query "!_D_Key!" /s /f "!_D_KVD!" /d echo.& echo ;; ---------------------------------------------------------------------------- set _D_DrvKeyN= for /F "usebackq skip=1 tokens=6-7 delims=\" %%a in ( `reg query "!_D_Key!" /s /f "!_D_KVD!" /k` ) do ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" set _D_DrvKeyN=%%~b if "!_D_DrvKeyN!"=="" ( set _D_DriverDesc= set _D_DriverVersion= set _D_MatchingDeviceId= set _D_InfPath= set _D_InfPath-s= set _D_InfPath-o= set _D_SDrvVer= set _D_RDrvVer= set _D_FRepDir= set _D_DrvFPath= set _D_IncludedInfs= rem set _D_IncludedInfs-s= rem set _D_IncludedInfs-o= set _D_CoInstallers32= rem set _D_CoInstallers32-s= ) else ( echo. echo ;;@ Driver Key No.: "!_D_DrvKeyN!" echo.& echo ;; ---------------------------------------------------------------------------- set _D_Key=!__DK!!_D_ControlSet!\Control\Class\!_D_DevCGUID!\!_D_DrvKeyN! rem set _D_KVD=DriverDesc rem set _D_KVD=DriverVersion rem set _D_KVD=MatchingDeviceId rem set _D_KVD=InfPath rem set _D_KVD=IncludedInfs rem set _D_KVD=CoInstallers32 set _D_KVD=* rem reg query "!_D_Key!" /s /f "!_D_KVD!" /k reg query "!_D_Key!" /v "!_D_KVD!" /s rem reg query "!_D_Key!" /ve /s rem reg query "!_D_Key!" /s /f "!_D_KVD!" /d set _D_KVD=DriverDesc rem reg query "!_D_Key!" /s /f "!_D_KVD!" /k rem reg query "!_D_Key!" /v "!_D_KVD!" /s rem reg query "!_D_Key!" /ve /s rem reg query "!_D_Key!" /s /f "!_D_KVD!" /d set _D_DriverDesc= for /F "usebackq skip=2 tokens=2* delims= " %%a in ( `reg query "!_D_Key!" /v "!_D_KVD!"` ) do ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" set _D_DriverDesc=%%~b echo. echo ;;* DriverDesc: %%~a "!_D_DriverDesc!" ) set _D_KVD=DriverVersion rem reg query "!_D_Key!" /s /f "!_D_KVD!" /k rem reg query "!_D_Key!" /v "!_D_KVD!" /s rem reg query "!_D_Key!" /ve /s rem reg query "!_D_Key!" /s /f "!_D_KVD!" /d set _D_DriverVersion= for /F "usebackq skip=2 tokens=2* delims= " %%a in ( `reg query "!_D_Key!" /v "!_D_KVD!"` ) do ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" set _D_DriverVersion=%%~b echo. echo ;;* DriverVersion: %%~a "!_D_DriverVersion!" ) set _D_KVD=MatchingDeviceId rem reg query "!_D_Key!" /s /f "!_D_KVD!" /k rem reg query "!_D_Key!" /v "!_D_KVD!" /s rem reg query "!_D_Key!" /ve /s rem reg query "!_D_Key!" /s /f "!_D_KVD!" /d set _D_MatchingDeviceId= for /F "usebackq skip=2 tokens=2* delims= " %%a in ( `reg query "!_D_Key!" /v "!_D_KVD!"` ) do ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" set _D_MatchingDeviceId=%%~b echo. echo ;;* MatchingDeviceId: %%~a "!_D_MatchingDeviceId!" ) set _D_KVD=InfPath rem reg query "!_D_Key!" /s /f "!_D_KVD!" /k rem reg query "!_D_Key!" /v "!_D_KVD!" /s rem reg query "!_D_Key!" /ve /s rem reg query "!_D_Key!" /s /f "!_D_KVD!" /d set _D_InfPath= for /F "usebackq skip=2 tokens=2* delims= " %%a in ( `reg query "!_D_Key!" /v "!_D_KVD!"` ) do ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" set _D_InfPath=%%~b echo. echo ;;* InfPath: %%~a "!_D_InfPath!" rem setlocal enabledelayedexpansion if not "!_D_InfPath!"=="" set _D_InfPath=!_D_InfPath:\0= ! if not "!_D_InfPath!"=="" set _D_InfPath=!_D_InfPath:,=/! for %%a in (!_D_InfPath!) do ( for /F "tokens=1* delims=/" %%b in ("%%~a") do ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" set _D_InfPath-s=%%~b rem echo ;;. Ps "!_D_InfPath-s!" if not exist "!__WD!inf.s32\!_D_InfPath-s!" ( rem echo ;;. To be converted from Unicode ^(only UTF-16LE w/ BOM^) to ANSI by type command echo ;;^> type "!__DD!inf\!_D_InfPath-s!" ^> "!__WD!inf.s32\!_D_InfPath-s!" type "!__DD!inf\!_D_InfPath-s!" > "!__WD!inf.s32\!_D_InfPath-s!" ) set _D_InfPath-o= set _D_SDrvVer-c= set _D_SctN= if exist "!__WD!inf.s32\!_D_InfPath-s!" ( for /F "usebackq eol=; tokens=1* delims== " %%a in ("!__WD!inf.s32\!_D_InfPath-s!") do ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" set _D_Fld0=%%~a if not "!_D_Fld0!"=="" if /I "!_D_Fld0:~,1!"=="[" ( set _D_SctN=!_D_Fld0! ) rem echo !_D_SctN! "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" if /I "!_D_SctN!"=="[Version]" ( rem echo ;;. !_D_SctN! "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" rem INF Version Section (Windows Drivers) rem http://msdn.microsoft.com/en-us/library/windows/hardware/ff547502(v=vs.85).aspx rem DriverVer=mm/dd/yyyy[,w.x.y.z] if /I "!_D_Fld0!"=="DriverVer" ( set _D_SDrvVer-c=%%~b for /L %%a in (1,1,1) do ( set _D_Nxt1= if not "!_D_SDrvVer-c!"=="" set _D_Nxt1=!_D_SDrvVer-c:*,=! if /I not "!_D_SDrvVer-c!"=="!_D_Nxt1!" ( set _D_SDrvVer-c=!_D_Nxt1! ) else ( set _D_SDrvVer-c= ) rem echo ;;. #%%~a "!_D_SDrvVer-c!" ) for /F "tokens=1* delims=, " %%a in ("!_D_SDrvVer-c!") do ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" set _D_SDrvVer-c=%%~a ) rem if not "!_D_SDrvVer-c!"=="" echo ;;. Vc "!_D_SDrvVer-c!" ) if /I "!_D_Fld0!"=="CatalogFile" set _D_Fld0=!_D_Fld0!.nt if /I "!_D_Fld0!"=="CatalogFile.nt" set _D_Fld0=!_D_Fld0!!_D_PROCESSOR_ARCHITECTURE! if /I "!_D_Fld0!"=="CatalogFile.nt!_D_PROCESSOR_ARCHITECTURE!" ( set _D_InfPath-o=%%~b if not "!_D_InfPath-o!"=="" ( set _D_InfPath-o=!_D_InfPath-o:.cat=.inf! rem echo ;;. Po "!_D_InfPath-o!" estimated from !_D_Fld0! "%%~b" ) ) ) ) ) if "!_D_InfPath-o!"=="" set _D_InfPath-o=!_D_InfPath-s! if /I not "!_D_InfPath-o!"=="!_D_InfPath-s!" ( echo. echo ;;+ Original Inf Path: "!_D_InfPath-o!" ) set _D_SDrvVer=!_D_SDrvVer-c! if "!_D_SDrvVer!"=="" ( echo ;;/ Warn: "System Inf DriverVer" not found ) else ( echo. echo ;;+ System Inf DriverVer: "!_D_SDrvVer!" if /I not "!_D_SDrvVer!"=="!_D_DriverVersion!" ( echo ;;/ Warn: "System Inf DriverVer" different from "DriverVersion" ) else ( echo ;;. Info: "System Inf DriverVer" same as "DriverVersion" if not exist "!__WD!inf.org\!_D_InfPath-o!" ( echo ;;^> copy "!__WD!inf.s32\!_D_InfPath-s!" "!__WD!inf.org\!_D_InfPath-o!" copy "!__WD!inf.s32\!_D_InfPath-s!" "!__WD!inf.org\!_D_InfPath-o!" ) ) ) set _D_FRepDir= set _D_RDrvVer= for /D %%a in ("!__DD!system32\DriverStore\FileRepository\!_D_InfPath-o!_!_D_PROCESSOR_ARCHITECTURE!_neutral_*") do ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" if "!_D_RDrvVer!"=="" if exist "%%~a\!_D_InfPath-o!" ( set _D_FRepDir-c=%%~a if not "!_D_FRepDir-c!"=="" set _D_FRepDir-c=!_D_FRepDir-c:*%SystemRoot:~3%\=! echo. rem echo ;;. Dc "!_D_FRepDir-c!" rem echo ;;. To be converted from Unicode ^(only UTF-16LE w/ BOM^) to ANSI by type command echo ;;^> type "!__DD!!_D_FRepDir-c!\!_D_InfPath-o!" ^> "!__WD!inf.rep\!_D_InfPath-o!" type "!__DD!!_D_FRepDir-c!\!_D_InfPath-o!" > "!__WD!inf.rep\!_D_InfPath-o!" set _D_RDrvVer-c= set _D_SctN= if exist "!__WD!inf.rep\!_D_InfPath-o!" ( for /F "usebackq eol=; tokens=1* delims== " %%a in ("!__WD!inf.rep\!_D_InfPath-o!") do ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" set _D_Fld0=%%~a if not "!_D_Fld0!"=="" if /I "!_D_Fld0:~,1!"=="[" ( set _D_SctN=!_D_Fld0! ) rem echo !_D_SctN! "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" if /I "!_D_SctN!"=="[Version]" ( rem echo ;;. !_D_SctN! "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" rem INF Version Section (Windows Drivers) rem http://msdn.microsoft.com/en-us/library/windows/hardware/ff547502(v=vs.85).aspx rem DriverVer=mm/dd/yyyy[,w.x.y.z] if /I "!_D_Fld0!"=="DriverVer" ( set _D_RDrvVer-c=%%~b for /L %%a in (1,1,1) do ( set _D_Nxt1= if not "!_D_RDrvVer-c!"=="" set _D_Nxt1=!_D_RDrvVer-c:*,=! if /I not "!_D_RDrvVer-c!"=="!_D_Nxt1!" ( set _D_RDrvVer-c=!_D_Nxt1! ) else ( set _D_RDrvVer-c= ) rem echo ;;. #%%~a "!_D_RDrvVer-c!" ) for /F "tokens=1* delims=, " %%a in ("!_D_RDrvVer-c!") do ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" set _D_RDrvVer-c=%%~a ) rem if not "!_D_RDrvVer-c!"=="" echo ;;. Vc "!_D_RDrvVer-c!" ) ) ) ) if "!_D_RDrvVer-c!"=="" ( echo ;;. Info: "Repository Inf DriverVer" not found ) else ( if /I not "!_D_RDrvVer-c!"=="!_D_DriverVersion!" ( echo ;;. Info: "Repository Inf DriverVer" different from "DriverVersion" ) else ( echo ;;. Info: "Repository Inf DriverVer" same as "DriverVersion" if not exist "!__WD!inf.org\!_D_InfPath-o!" ( echo ;;^> copy "!__WD!inf.rep\!_D_InfPath-o!" "!__WD!inf.org\!_D_InfPath-o!" copy "!__WD!inf.rep\!_D_InfPath-o!" "!__WD!inf.org\!_D_InfPath-o!" ) set _D_FRepDir=!_D_FRepDir-c! rem if not "!_D_FRepDir!"=="" echo ;;. Dr "!_D_FRepDir!" set _D_RDrvVer=!_D_RDrvVer-c! rem if not "!_D_RDrvVer!"=="" echo ;;. Vr "!_D_RDrvVer!" ) ) ) ) if not "!_D_RDrvVer!"=="" ( echo. echo ;;+ Repository Inf DriverVer: "!_D_RDrvVer!" ) if not "!_D_FRepDir!"=="" ( echo. echo ;;+ File Repository Directory: "!_D_FRepDir!" ) set _D_DrvFPath-c= set _D_SctN= if exist "!__WD!inf.org\!_D_InfPath-o!" ( for /F "usebackq eol=; tokens=1* delims== " %%a in ("!__WD!inf.org\!_D_InfPath-o!") do ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" set _D_Fld0=%%~a if not "!_D_Fld0!"=="" if /I "!_D_Fld0:~,1!"=="[" ( set _D_SctN=!_D_Fld0! if /I "!_D_SctN!"=="[SourceDisksNames]" set _D_SctN=[SourceDisksNames.!_D_PROCESSOR_ARCHITECTURE!] ) rem echo !_D_SctN! "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" if /I "!_D_SctN!"=="[SourceDisksNames.!_D_PROCESSOR_ARCHITECTURE!]" ( rem echo ;;. !_D_SctN! "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" rem INF SourceDisksNames Section (Windows Drivers) rem http://msdn.microsoft.com/en-us/library/windows/hardware/ff547478(v=vs.85).aspx rem diskid = disk-description[,[tag-or-cab-file],[unused],[path],[flags][,tag-file]] if not "!_D_Fld0!"=="" ( set _D_DrvFPath-c=%%~b for /L %%a in (1,1,3) do ( set _D_Nxt1= if not "!_D_DrvFPath-c!"=="" set _D_Nxt1=!_D_DrvFPath-c:*,=! if /I not "!_D_DrvFPath-c!"=="!_D_Nxt1!" ( set _D_DrvFPath-c=!_D_Nxt1! ) else ( set _D_DrvFPath-c= ) rem echo ;;. #%%~a "!_D_DrvFPath-c!" ) for /F "tokens=1* delims=, " %%a in ("!_D_DrvFPath-c!") do ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" set _D_DrvFPath-c=%%~a ) rem if not "!_D_DrvFPath-c!"=="" echo ;;. Pc "!_D_DrvFPath-c!" ) ) ) ) set _D_DrvFPath=!_D_DrvFPath-c! if "!_D_DrvFPath!"=="" ( rem echo ;;. Info: "Driver File Path" not found ) else ( echo. echo ;;+ Driver File Path: "!_D_DrvFPath!" ) ) ) rem endlocal set _D_Fld0= set _D_SctN= set _D_Nxt1= set _D_SDrvVer-c= set _D_RDrvVer-c= set _D_FRepDir-c= set _D_DrvFPath-c= ) set _D_KVD=IncludedInfs rem reg query "!_D_Key!" /s /f "!_D_KVD!" /k rem reg query "!_D_Key!" /v "!_D_KVD!" /s rem reg query "!_D_Key!" /ve /s rem reg query "!_D_Key!" /s /f "!_D_KVD!" /d set _D_IncludedInfs= for /F "usebackq skip=2 tokens=2* delims= " %%a in ( `reg query "!_D_Key!" /v "!_D_KVD!" 2^>nul` ) do ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" set _D_IncludedInfs=%%~b echo. echo ;;* IncludedInfs: %%~a "!_D_IncludedInfs!" setlocal enabledelayedexpansion if not "!_D_IncludedInfs!"=="" set _D_IncludedInfs=!_D_IncludedInfs:\0= ! if not "!_D_IncludedInfs!"=="" set _D_IncludedInfs=!_D_IncludedInfs:,=/! for %%a in (!_D_IncludedInfs!) do ( for /F "tokens=1* delims=/" %%b in ("%%~a") do ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" set _D_IncludedInfs-s=%%~b rem echo ;;. Is "!_D_IncludedInfs-s!" if not exist "!__WD!inf.s32\!_D_IncludedInfs-s!" ( rem echo ;;. To be converted from Unicode ^(only UTF-16LE w/ BOM^) to ANSI by type command echo ;;^> type "!__DD!inf\!_D_IncludedInfs-s!" ^> "!__WD!inf.s32\!_D_IncludedInfs-s!" type "!__DD!inf\!_D_IncludedInfs-s!" > "!__WD!inf.s32\!_D_IncludedInfs-s!" ) set _D_IncludedInfs-o= set _D_SctN= if exist "!__WD!inf.s32\!_D_IncludedInfs-s!" ( for /F "usebackq eol=; tokens=1* delims== " %%a in ("!__WD!inf.s32\!_D_IncludedInfs-s!") do ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" set _D_Fld0=%%~a if not "!_D_Fld0!"=="" if /I "!_D_Fld0:~,1!"=="[" ( set _D_SctN=!_D_Fld0! ) rem echo !_D_SctN! "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" if /I "!_D_SctN!"=="[Version]" ( rem echo ;;. !_D_SctN! "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" if /I "!_D_Fld0!"=="CatalogFile" set _D_Fld0=!_D_Fld0!.nt if /I "!_D_Fld0!"=="CatalogFile.nt" set _D_Fld0=!_D_Fld0!!_D_PROCESSOR_ARCHITECTURE! if /I "!_D_Fld0!"=="CatalogFile.nt!_D_PROCESSOR_ARCHITECTURE!" ( set _D_IncludedInfs-o=%%~b if not "!_D_IncludedInfs-o!"=="" ( set _D_IncludedInfs-o=!_D_IncludedInfs-o:.cat=.inf! rem echo ;;. Io "!_D_IncludedInfs-o!" estimated from !_D_Fld0! "%%~b" ) ) ) ) ) if "!_D_IncludedInfs-o!"=="" set _D_IncludedInfs-o=!_D_IncludedInfs-s! if /I not "!_D_IncludedInfs-o!"=="!_D_IncludedInfs-s!" ( echo. echo ;;+ Original Inf Path: "!_D_IncludedInfs-o!" ) if not exist "!__WD!inf.org\!_D_IncludedInfs-o!" ( echo ;;^> copy "!__WD!inf.s32\!_D_IncludedInfs-s!" "!__WD!inf.org\!_D_IncludedInfs-o!" copy "!__WD!inf.s32\!_D_IncludedInfs-s!" "!__WD!inf.org\!_D_IncludedInfs-o!" ) ) ) endlocal ) set _D_KVD=CoInstallers32 rem reg query "!_D_Key!" /s /f "!_D_KVD!" /k rem reg query "!_D_Key!" /v "!_D_KVD!" /s rem reg query "!_D_Key!" /ve /s rem reg query "!_D_Key!" /s /f "!_D_KVD!" /d set _D_CoInstallers32= for /F "usebackq skip=2 tokens=2* delims= " %%a in ( `reg query "!_D_Key!" /v "!_D_KVD!" 2^>nul` ) do ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" set _D_CoInstallers32=%%~b echo. echo ;;* CoInstallers32: %%~a "!_D_CoInstallers32!" setlocal enabledelayedexpansion if not "!_D_CoInstallers32!"=="" set _D_CoInstallers32=!_D_CoInstallers32:\0= ! if not "!_D_CoInstallers32!"=="" set _D_CoInstallers32=!_D_CoInstallers32:,=/! for %%a in (!_D_CoInstallers32!) do ( for /F "tokens=1* delims=/" %%b in ("%%~a") do ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" set _D_CoInstallers32-s=%%~b rem echo ;;. Is "!_D_CoInstallers32-s!" if not exist "!__WD!system32\!_D_CoInstallers32-s!" ( echo ;;^> copy "!__DD!system32\!_D_CoInstallers32-s!" "!__WD!system32\!_D_CoInstallers32-s!" copy "!__DD!system32\!_D_CoInstallers32-s!" "!__WD!system32\!_D_CoInstallers32-s!" ) if not exist "!__WD!inf.org\!_D_CoInstallers32-s!" ( echo ;;^> copy "!__WD!system32\!_D_CoInstallers32-s!" "!__WD!inf.org\!_D_CoInstallers32-s!" copy "!__WD!system32\!_D_CoInstallers32-s!" "!__WD!inf.org\!_D_CoInstallers32-s!" ) ) ) endlocal ) echo.& echo ;; ---------------------------------------------------------------------------- ) set _D_Key=!__DK!!_D_ControlSet!\Enum if "!_D_DrvKeyN!"=="" ( set _D_KVD=!_D_DevCGUID! ) else ( set _D_KVD=!_D_DevCGUID!\!_D_DrvKeyN! ) rem reg query "!_D_Key!" /s /f "!_D_KVD!" /k rem reg query "!_D_Key!" /v "!_D_KVD!" /s rem reg query "!_D_Key!" /ve /s reg query "!_D_Key!" /s /f "!_D_KVD!" /d set _D_DevIPath= for /F "usebackq skip=1 tokens=4* delims=\" %%a in ( `reg query "!_D_Key!" /s /f "!_D_KVD!" /d` ) do ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" set _D_DevIPath=%%~b echo. echo ;;@ Device Instance Path: "!_D_DevIPath!" set _D_Key=!__DK!!_D_ControlSet!\Enum\!_D_DevIPath! rem set _D_KVD=DeviceDesc rem set _D_KVD=Mfg rem set _D_KVD=Class rem set _D_KVD=ClassGUID rem set _D_KVD=Driver rem set _D_KVD=Service rem set _D_KVD=ActiveService rem set _D_KVD=SymbolicName set _D_KVD=* rem reg query "!_D_Key!" /s /f "!_D_KVD!" /k reg query "!_D_Key!" /v "!_D_KVD!" /s rem reg query "!_D_Key!" /ve /s rem reg query "!_D_Key!" /s /f "!_D_KVD!" /d set _D_KVD=DeviceDesc rem reg query "!_D_Key!" /s /f "!_D_KVD!" /k rem reg query "!_D_Key!" /v "!_D_KVD!" /s rem reg query "!_D_Key!" /ve /s rem reg query "!_D_Key!" /s /f "!_D_KVD!" /d set _D_DeviceDesc= for /F "usebackq skip=2 tokens=2* delims= " %%a in ( `reg query "!_D_Key!" /v "!_D_KVD!"` ) do ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" set _D_DeviceDesc=%%~b echo. echo ;;* DeviceDesc: %%~a "!_D_DeviceDesc!" ) set _D_KVD=Mfg rem reg query "!_D_Key!" /s /f "!_D_KVD!" /k rem reg query "!_D_Key!" /v "!_D_KVD!" /s rem reg query "!_D_Key!" /ve /s rem reg query "!_D_Key!" /s /f "!_D_KVD!" /d set _D_Mfg= for /F "usebackq skip=2 tokens=2* delims= " %%a in ( `reg query "!_D_Key!" /v "!_D_KVD!" 2^>nul` ) do ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" set _D_Mfg=%%~b echo. echo ;;* Mfg: %%~a "!_D_Mfg!" ) set _D_KVD=Class rem reg query "!_D_Key!" /s /f "!_D_KVD!" /k rem reg query "!_D_Key!" /v "!_D_KVD!" /s rem reg query "!_D_Key!" /ve /s rem reg query "!_D_Key!" /s /f "!_D_KVD!" /d set _D_Class= for /F "usebackq skip=2 tokens=2* delims= " %%a in ( `reg query "!_D_Key!" /v "!_D_KVD!"` ) do ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" set _D_Class=%%~b echo. echo ;;* Class: %%~a "!_D_Class!" ) set _D_KVD=ClassGUID rem reg query "!_D_Key!" /s /f "!_D_KVD!" /k rem reg query "!_D_Key!" /v "!_D_KVD!" /s rem reg query "!_D_Key!" /ve /s rem reg query "!_D_Key!" /s /f "!_D_KVD!" /d set _D_ClassGUID= for /F "usebackq skip=2 tokens=2* delims= " %%a in ( `reg query "!_D_Key!" /v "!_D_KVD!"` ) do ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" set _D_ClassGUID=%%~b echo. echo ;;* ClassGUID: %%~a "!_D_ClassGUID!" if /I not "!_D_ClassGUID!"=="!_D_DevCGUID!" ( echo ;;/ Warn: "ClassGUID" different from "Device Class GUID" ) else ( echo ;;. Info: "ClassGUID" same as "Device Class GUID" ) ) set _D_KVD=Driver rem reg query "!_D_Key!" /s /f "!_D_KVD!" /k rem reg query "!_D_Key!" /v "!_D_KVD!" /s rem reg query "!_D_Key!" /ve /s rem reg query "!_D_Key!" /s /f "!_D_KVD!" /d set _D_Driver= for /F "usebackq skip=2 tokens=2* delims= " %%a in ( `reg query "!_D_Key!" /v "!_D_KVD!" 2^>nul` ) do ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" set _D_Driver=%%~b echo. echo ;;* Driver: %%~a "!_D_Driver!" if /I not "!_D_Driver!"=="!_D_DevCGUID!\!_D_DrvKeyN!" ( echo ;;/ Warn: "Driver" different from "Device Class GUID" \ "Driver Key No." ) else ( echo ;;. Info: "Driver" same as "Device Class GUID" \ "Driver Key No." ) ) set _D_KVD=Service rem reg query "!_D_Key!" /s /f "!_D_KVD!" /k rem reg query "!_D_Key!" /v "!_D_KVD!" /s rem reg query "!_D_Key!" /ve /s rem reg query "!_D_Key!" /s /f "!_D_KVD!" /d set _D_Service= for /F "usebackq skip=2 tokens=2* delims= " %%a in ( `reg query "!_D_Key!" /v "!_D_KVD!"` ) do ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" set _D_Service=%%~b echo. echo ;;* Service: %%~a "!_D_Service!" setlocal enabledelayedexpansion set _D_SMatch= for %%b in (%_D_LSMatch%) do ( if not "!_D_Service!"=="" if /I not "!_D_Service:%%~b=!"=="!_D_Service!" set _D_SMatch=%%~b ) if not "!_D_SMatch!"=="" ( echo ;;. String Matched as the Filename: "!_D_SMatch!" ) if not "!_D_DrvKeyN!"=="" if "!_D_SMatch!"=="" set _D_SMatch=__TRUE__ if not "!_D_SMatch!"=="" ( if not exist "!__WD!system32\drivers\!_D_Service!.sys" ( echo ;;^> copy "!__DD!system32\drivers\!_D_Service!.sys" "!__WD!system32\drivers\!_D_Service!.sys" copy "!__DD!system32\drivers\!_D_Service!.sys" "!__WD!system32\drivers\!_D_Service!.sys" ) if not "!_D_DrvFPath!"=="\" set _D_DrvFPath=!_D_DrvFPath!\ if not exist "!__WD!inf.org!_D_DrvFPath!" md "!__WD!inf.org!_D_DrvFPath!" if not exist "!__WD!inf.org!_D_DrvFPath!!_D_Service!.sys" ( echo ;;^> copy "!__WD!system32\drivers\!_D_Service!.sys" "!__WD!inf.org!_D_DrvFPath!!_D_Service!.sys" copy "!__WD!system32\drivers\!_D_Service!.sys" "!__WD!inf.org!_D_DrvFPath!!_D_Service!.sys" ) if not "!_D_IncludedInfs!"=="" call :IncludedDrvs if not exist "!__WD!reg.org\Control\CriticalDeviceDatabase\!__DP!!_D_Service!_!_D_DrvKeyN!.reg" ( if not "_D_MatchingDeviceId"=="" ( echo ;;^> reg export "!__DK!!_D_ControlSet!\Control\CriticalDeviceDatabase\!_D_MatchingDeviceId:\=#!" "!__WD!reg.org\Control\CriticalDeviceDatabase\!__DP!!_D_Service!_!_D_DrvKeyN!.reg" /y reg export "!__DK!!_D_ControlSet!\Control\CriticalDeviceDatabase\!_D_MatchingDeviceId:\=#!" "!__WD!reg.org\Control\CriticalDeviceDatabase\!__DP!!_D_Service!_!_D_DrvKeyN!.reg" /y ) if errorlevel 1 ( setlocal enabledelayedexpansion if not "_D_MatchingDeviceId"=="" set _D_MatchingDeviceId=!_D_MatchingDeviceId:^&rev_= ! for /F %%a in ("!_D_MatchingDeviceId!") do set _D_MatchingDeviceId=%%~a if not "_D_MatchingDeviceId"=="" ( echo ;;/ Error Retry: "MatchingDeviceId" assumed to be "!_D_MatchingDeviceId!" echo ;;/ Error Retry: "MatchingDeviceId" assumed to be "!_D_MatchingDeviceId!">con echo ;;^> reg export "!__DK!!_D_ControlSet!\Control\CriticalDeviceDatabase\!_D_MatchingDeviceId:\=#!" "!__WD!reg.org\Control\CriticalDeviceDatabase\!__DP!!_D_Service!_!_D_DrvKeyN!.reg" /y reg export "!__DK!!_D_ControlSet!\Control\CriticalDeviceDatabase\!_D_MatchingDeviceId:\=#!" "!__WD!reg.org\Control\CriticalDeviceDatabase\!__DP!!_D_Service!_!_D_DrvKeyN!.reg" /y ) endlocal ) ) if not exist "!__WD!reg.org\services\!__DP!!_D_Service!.reg" ( echo ;;^> reg export "!__DK!!_D_ControlSet!\services\!_D_Service!" "!__WD!reg.org\services\!__DP!!_D_Service!.reg" /y reg export "!__DK!!_D_ControlSet!\services\!_D_Service!" "!__WD!reg.org\services\!__DP!!_D_Service!.reg" /y ) if not exist "!__WD!reg.mod\Control\CriticalDeviceDatabase\!__DP!!_D_Service!_!_D_DrvKeyN!.reg" ( for /F "usebackq eol= skip=2 tokens=1* delims==" %%a in ( `type "!__WD!reg.org\Control\CriticalDeviceDatabase\!__DP!!_D_Service!_!_D_DrvKeyN!.reg"` ) do ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" if /I "%%~b"=="" ( echo.>> "!__WD!reg.mod\Control\CriticalDeviceDatabase\!__DP!!_D_Service!_!_D_DrvKeyN!.reg" echo %%~a>> "!__WD!reg.mod\Control\CriticalDeviceDatabase\!__DP!!_D_Service!_!_D_DrvKeyN!.reg" ) else ( if /I "%%~a"=="ClassGUID" echo "%%~a"=%%b>> "!__WD!reg.mod\Control\CriticalDeviceDatabase\!__DP!!_D_Service!_!_D_DrvKeyN!.reg" if /I "%%~a"=="Service" echo "%%~a"=%%b>> "!__WD!reg.mod\Control\CriticalDeviceDatabase\!__DP!!_D_Service!_!_D_DrvKeyN!.reg" ) ) ) if not exist "!__WD!reg.mod\services\!__DP!!_D_Service!.reg" ( set _D_Flg0=21GTS set _D_Rem0= for /F "usebackq eol= skip=2 tokens=1* delims==" %%a in ( `type "!__WD!reg.org\services\!__DP!!_D_Service!.reg"` ) do ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" if /I "%%~b"=="" ( if not "!_D_Flg0!"=="" ( if not "!_D_Flg0!"=="!_D_Flg0:2=!" ( echo [!_D_Service!]>> "!__WD!system32\UsbBootWatcher.conf" set _D_Flg0=!_D_Flg0:2=! ) else if not "!_D_Flg0!"=="!_D_Flg0:1=!" ( if not "!_D_Flg0!"=="" if not "!_D_Flg0!"=="!_D_Flg0:G=!" ( echo "Group"="Boot Bus Extender" ; n/a>> "!__WD!reg.mod\services\!__DP!!_D_Service!.reg" echo Group@REG_SZ="Boot Bus Extender">> "!__WD!system32\UsbBootWatcher.conf" set _D_Flg0=!_D_Flg0:G=! ) if not "!_D_Flg0!"=="" if not "!_D_Flg0!"=="!_D_Flg0:T=!" ( echo "Tag"=dword:00000006 ; n/a>> "!__WD!reg.mod\services\!__DP!!_D_Service!.reg" set _D_Flg0=!_D_Flg0:T=! ) if not "!_D_Flg0!"=="" if not "!_D_Flg0!"=="!_D_Flg0:S=!" ( echo "Start"=dword:00000000 ; n/a>> "!__WD!reg.mod\services\!__DP!!_D_Service!.reg" (echo Start@REG_DWORD=0)>> "!__WD!system32\UsbBootWatcher.conf" set _D_Flg0=!_D_Flg0:S=! ) set _D_Flg0=!_D_Flg0:1=! ) ) set _D_Rem0=%%~a if not "!_D_Rem0!"=="" ( rem Comment out for WindowsPE on HDD if not "!_D_Rem0!"=="!_D_Rem0:\services\USBSTOR\Enum]=!" set _D_Rem0=; if not "!_D_Rem0!"==";" set _D_Rem0= ) echo.>> "!__WD!reg.mod\services\!__DP!!_D_Service!.reg" echo %%~a>> "!__WD!reg.mod\services\!__DP!!_D_Service!.reg" ) else ( set _D_Tmp0=%%b if not "!_D_Tmp0!"=="" if /I not "!_D_Tmp0:~-1!"=="\" ( if not "!_D_Flg0!"=="" ( if not "!_D_Flg0!"=="!_D_Flg0:1=!" ( if /I "%%~a"=="Group" ( if /I "%%~b"=="Base" ( echo "%%~a"="Boot Bus Extender" ; %%b>> "!__WD!reg.mod\services\!__DP!!_D_Service!.reg" echo Group@REG_SZ="Boot Bus Extender">> "!__WD!system32\UsbBootWatcher.conf" ) else ( echo "%%~a"=%%b>> "!__WD!reg.mod\services\!__DP!!_D_Service!.reg" echo Group@REG_SZ=%%b>> "!__WD!system32\UsbBootWatcher.conf" ) if not "!_D_Flg0!"=="" if not "!_D_Flg0!"=="!_D_Flg0:G=!" set _D_Flg0=!_D_Flg0:G=! ) if /I "%%~a"=="Tag" ( rem CurrentControlSet\Services Subkey Entries rem http://support.microsoft.com/kb/103000/en set _D_Tmp0=%%~b if not "!_D_Tmp0!"=="" set _D_Tmp0=0x!_D_Tmp0:~6! if /I !_D_Tmp0! GTR 0x00000006 ( if /I !_D_Tmp0! LSS 0x00000019 ( echo "%%~a"=dword:00000006 ; %%b>> "!__WD!reg.mod\services\!__DP!!_D_Service!.reg" ) else ( echo "%%~a"=%%b>> "!__WD!reg.mod\services\!__DP!!_D_Service!.reg" ) ) else ( echo "%%~a"=%%b>> "!__WD!reg.mod\services\!__DP!!_D_Service!.reg" ) if not "!_D_Flg0!"=="" if not "!_D_Flg0!"=="!_D_Flg0:T=!" set _D_Flg0=!_D_Flg0:T=! rem set _D_Tmp0= ) if /I "%%~a"=="Start" ( if /I "%%~b"=="dword:00000003" ( echo "%%~a"=dword:00000000 ; %%b>> "!__WD!reg.mod\services\!__DP!!_D_Service!.reg" (echo Start@REG_DWORD=0)>> "!__WD!system32\UsbBootWatcher.conf" ) else ( echo "%%~a"=%%b>> "!__WD!reg.mod\services\!__DP!!_D_Service!.reg" (echo Start@REG_DWORD=0)>> "!__WD!system32\UsbBootWatcher.conf" ) if not "!_D_Flg0!"=="" if not "!_D_Flg0!"=="!_D_Flg0:S=!" set _D_Flg0=!_D_Flg0:S=! ) if /I "%%~a"=="DisplayName" echo "%%~a"=%%b>> "!__WD!reg.mod\services\!__DP!!_D_Service!.reg" if /I "%%~a"=="ErrorControl" echo "%%~a"=%%b>> "!__WD!reg.mod\services\!__DP!!_D_Service!.reg" if /I "%%~a"=="Type" echo "%%~a"=%%b>> "!__WD!reg.mod\services\!__DP!!_D_Service!.reg" if /I "%%~a"=="BootFlags" echo "%%~a"=%%b>> "!__WD!reg.mod\services\!__DP!!_D_Service!.reg" rem INF AddService Directive (Windows Drivers) rem http://msdn.microsoft.com/en-us/library/windows/hardware/ff546326(v=vs.85).aspx rem BootFlags 0x94 = 0x4:USB + 0x10:USB3.0 + 0x80:WinPE ) else ( echo "%%~a"=%%b>> "!__WD!reg.mod\services\!__DP!!_D_Service!.reg" ) ) else ( echo !_D_Rem0!"%%~a"=%%b>> "!__WD!reg.mod\services\!__DP!!_D_Service!.reg" ) ) set _D_Tmp0= ) ) if not "!_D_Flg0!"=="" if not "!_D_Flg0!"=="!_D_Flg0:1=!" ( if not "!_D_Flg0!"=="" if not "!_D_Flg0!"=="!_D_Flg0:G=!" ( echo "Group"="Boot Bus Extender" ; n/a>> "!__WD!reg.mod\services\!__DP!!_D_Service!.reg" echo Group@REG_SZ="Boot Bus Extender">> "!__WD!system32\UsbBootWatcher.conf" set _D_Flg0=!_D_Flg0:G=! ) if not "!_D_Flg0!"=="" if not "!_D_Flg0!"=="!_D_Flg0:T=!" ( echo "Tag"=dword:00000006 ; n/a>> "!__WD!reg.mod\services\!__DP!!_D_Service!.reg" set _D_Flg0=!_D_Flg0:T=! ) if not "!_D_Flg0!"=="" if not "!_D_Flg0!"=="!_D_Flg0:S=!" ( echo "Start"=dword:00000000 ; n/a>> "!__WD!reg.mod\services\!__DP!!_D_Service!.reg" (echo Start@REG_DWORD=0)>> "!__WD!system32\UsbBootWatcher.conf" set _D_Flg0=!_D_Flg0:S=! ) set _D_Flg0=!_D_Flg0:1=! ) rem set _D_Flg0= rem set _D_Rem0= ) ) endlocal ) set _D_KVD=ActiveService rem reg query "!_D_Key!" /s /f "!_D_KVD!" /k rem reg query "!_D_Key!" /v "!_D_KVD!" /s rem reg query "!_D_Key!" /ve /s rem reg query "!_D_Key!" /s /f "!_D_KVD!" /d set _D_ActiveService= for /F "usebackq skip=2 tokens=2* delims= " %%a in ( `reg query "!_D_Key!" /v "!_D_KVD!" /s 2^>nul` ) do if /I "%%~a"=="REG_SZ" ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" set _D_ActiveService=%%~b echo. echo ;;* ActiveService: %%~a "!_D_ActiveService!" if /I not "!_D_ActiveService!"=="!_D_Service!" ( echo ;;/ Warn: "ActiveService" different from "Service" ) else ( echo ;;. Info: "ActiveService" same as "Service" ) setlocal enabledelayedexpansion set _D_SMatch= for %%b in (%_D_LSMatch%) do ( if not "!_D_ActiveService!"=="" if /I not "!_D_ActiveService:%%~b=!"=="!_D_ActiveService!" set _D_SMatch=%%~b ) if not "!_D_SMatch!"=="" ( echo ;;. String Matched as the Filename: "!_D_SMatch!" ) if not "!_D_DrvKeyN!"=="" if "!_D_SMatch!"=="" set _D_SMatch=__TRUE__ if not "!_D_SMatch!"=="" ( if not exist "!__WD!system32\drivers\!_D_ActiveService!.sys" ( echo ;;^> copy "!__DD!system32\drivers\!_D_ActiveService!.sys" "!__WD!system32\drivers\!_D_ActiveService!.sys" copy "!__DD!system32\drivers\!_D_ActiveService!.sys" "!__WD!system32\drivers\!_D_ActiveService!.sys" ) if not "!_D_DrvFPath!"=="\" set _D_DrvFPath=!_D_DrvFPath!\ if not exist "!__WD!inf.org!_D_DrvFPath!" md "!__WD!inf.org!_D_DrvFPath!" if not exist "!__WD!inf.org!_D_DrvFPath!!_D_ActiveService!.sys" ( echo ;;^> copy "!__WD!system32\drivers\!_D_ActiveService!.sys" "!__WD!inf.org!_D_DrvFPath!!_D_ActiveService!.sys" copy "!__WD!system32\drivers\!_D_ActiveService!.sys" "!__WD!inf.org!_D_DrvFPath!!_D_ActiveService!.sys" ) ) endlocal ) set _D_KVD=SymbolicName rem reg query "!_D_Key!" /s /f "!_D_KVD!" /k rem reg query "!_D_Key!" /v "!_D_KVD!" /s rem reg query "!_D_Key!" /ve /s rem reg query "!_D_Key!" /s /f "!_D_KVD!" /d set _D_SymbolicName= for /F "usebackq skip=2 tokens=2* delims= " %%a in ( `reg query "!_D_Key!" /v "!_D_KVD!" /s 2^>nul` ) do if /I "%%~a"=="REG_SZ" ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" set _D_SymbolicName=%%~b echo. echo ;;* SymbolicName: %%~a "!_D_SymbolicName!" ) echo.& echo ;; ---------------------------------------------------------------------------- if not "!_D_FRepDir!"=="" ( echo. echo ;;. Info: Complemented files shown below echo ;;^> xcopy /D /S /I /F /EXCLUDE:!__WD!inf.org\_EXCLUDE.TXT "!__DD!!_D_FRepDir!" "!__WD!inf.org\" xcopy /D /S /I /F /EXCLUDE:!__WD!inf.org\_EXCLUDE.TXT "!__DD!!_D_FRepDir!" "!__WD!inf.org\" ) set _D_Key= set _D_KVD= echo. echo ;;. Info: Environment variables shown below - Summary of collected informations echo ;;^> set _D_ set _D_ ) echo.& echo ;; ---------------------------------------------------------------------------- ) ) set _D_DrvFPath= set _D_Key=!__DK!!_D_ControlSet!\services set _D_KVD=ImagePath rem reg query "!_D_Key!" /s /f "!_D_KVD!" /k rem reg query "!_D_Key!" /v "!_D_KVD!" /s rem reg query "!_D_Key!" /ve /s rem reg query "!_D_Key!" /s /f "!_D_KVD!" /d set _D_ImagePath= for /F "usebackq skip=2 tokens=2* delims= " %%a in ( `reg query "!_D_Key!" /v "!_D_KVD!" /s 2^>nul` ) do if /I "%%~a"=="REG_EXPAND_SZ" ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" set _D_ImagePath=%%~b rem echo. rem echo ;;* ImagePath: %%~a "!_D_ImagePath!" if not "!_D_ImagePath!"=="" if /I not "!_D_ImagePath:*system32\drivers\=!"=="!_D_ImagePath!" ( setlocal enabledelayedexpansion if not "!_D_ImagePath!"=="" set _D_ImagePath=!_D_ImagePath:*system32\drivers\=! if not "!_D_ImagePath!"=="" set _D_ImagePath=!_D_ImagePath:.sys=! set _D_SMatch= for %%b in (%_D_LSMatch%) do ( if not "!_D_ImagePath!"=="" if /I not "!_D_ImagePath:%%~b=!"=="!_D_ImagePath!" set _D_SMatch=%%~b ) if not "!_D_SMatch!"=="" ( echo. echo ;;* Filebase of ImagePath: %%~a "!_D_ImagePath!" echo ;;. String Matched as the Filename: "!_D_SMatch!" ) if not "!_D_SMatch!"=="" ( if not exist "!__WD!system32\drivers\!_D_ImagePath!.sys" ( echo ;;^> copy "!__DD!system32\drivers\!_D_ImagePath!.sys" "!__WD!system32\drivers\!_D_ImagePath!.sys" copy "!__DD!system32\drivers\!_D_ImagePath!.sys" "!__WD!system32\drivers\!_D_ImagePath!.sys" ) if not "!_D_DrvFPath!"=="\" set _D_DrvFPath=!_D_DrvFPath!\ if not exist "!__WD!inf.org!_D_DrvFPath!" md "!__WD!inf.org!_D_DrvFPath!" if not exist "!__WD!inf.org!_D_DrvFPath!!_D_ImagePath!.sys" ( echo ;;^> copy "!__WD!system32\drivers\!_D_ImagePath!.sys" "!__WD!inf.org!_D_DrvFPath!!_D_ImagePath!.sys" copy "!__WD!system32\drivers\!_D_ImagePath!.sys" "!__WD!inf.org!_D_DrvFPath!!_D_ImagePath!.sys" ) ) endlocal ) ) echo.& echo ;; ---------------------------------------------------------------------------- if 0==1 ( set _D_Key=!__DK!!_D_ControlSet!\Enum set _D_KVD=Service rem reg query "!_D_Key!" /s /f "!_D_KVD!" /k rem reg query "!_D_Key!" /v "!_D_KVD!" /s rem reg query "!_D_Key!" /ve /s rem reg query "!_D_Key!" /s /f "!_D_KVD!" /d set _D_Service= for /F "usebackq skip=2 tokens=2* delims= " %%a in ( `reg query "!_D_Key!" /v "!_D_KVD!" /s 2^>nul` ) do if /I "%%~a"=="REG_SZ" ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" set _D_Service=%%~b rem echo. rem echo ;;* Service: %%~a "!_D_Service!" setlocal enabledelayedexpansion set _D_SMatch= for %%b in (%_D_LSMatch%) do ( if not "!_D_Service!"=="" if /I not "!_D_Service:%%~b=!"=="!_D_Service!" set _D_SMatch=%%~b ) if not "!_D_SMatch!"=="" ( echo. echo ;;* Service: %%~a "!_D_Service!" echo ;;. String Matched as the Filename: "!_D_SMatch!" ) if not "!_D_SMatch!"=="" ( if not exist "!__WD!system32\drivers\!_D_Service!.sys" ( echo ;;^> copy "!__DD!system32\drivers\!_D_Service!.sys" "!__WD!system32\drivers\!_D_Service!.sys" copy "!__DD!system32\drivers\!_D_Service!.sys" "!__WD!system32\drivers\!_D_Service!.sys" ) if not "!_D_DrvFPath!"=="\" set _D_DrvFPath=!_D_DrvFPath!\ if not exist "!__WD!inf.org!_D_DrvFPath!" md "!__WD!inf.org!_D_DrvFPath!" if not exist "!__WD!inf.org!_D_DrvFPath!!_D_Service!.sys" ( echo ;;^> copy "!__WD!system32\drivers\!_D_Service!.sys" "!__WD!inf.org!_D_DrvFPath!!_D_Service!.sys" copy "!__WD!system32\drivers\!_D_Service!.sys" "!__WD!inf.org!_D_DrvFPath!!_D_Service!.sys" ) ) endlocal ) echo.& echo ;; ---------------------------------------------------------------------------- set _D_KVD=ActiveService rem reg query "!_D_Key!" /s /f "!_D_KVD!" /k rem reg query "!_D_Key!" /v "!_D_KVD!" /s rem reg query "!_D_Key!" /ve /s rem reg query "!_D_Key!" /s /f "!_D_KVD!" /d set _D_ActiveService= for /F "usebackq skip=2 tokens=2* delims= " %%a in ( `reg query "!_D_Key!" /v "!_D_KVD!" /s 2^>nul` ) do if /I "%%~a"=="REG_SZ" ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" set _D_ActiveService=%%~b rem echo. rem echo ;;* ActiveService: %%~a "!_D_ActiveService!" setlocal enabledelayedexpansion set _D_SMatch= for %%b in (%_D_LSMatch%) do ( if not "!_D_ActiveService!"=="" if /I not "!_D_ActiveService:%%~b=!"=="!_D_ActiveService!" set _D_SMatch=%%~b ) if not "!_D_SMatch!"=="" ( echo. echo ;;* ActiveService: %%~a "!_D_ActiveService!" echo ;;. String Matched as the Filename: "!_D_SMatch!" ) if not "!_D_SMatch!"=="" ( if not exist "!__WD!system32\drivers\!_D_ActiveService!.sys" ( echo ;;^> copy "!__DD!system32\drivers\!_D_ActiveService!.sys" "!__WD!system32\drivers\!_D_ActiveService!.sys" copy "!__DD!system32\drivers\!_D_ActiveService!.sys" "!__WD!system32\drivers\!_D_ActiveService!.sys" ) if not "!_D_DrvFPath!"=="\" set _D_DrvFPath=!_D_DrvFPath!\ if not exist "!__WD!inf.org!_D_DrvFPath!" md "!__WD!inf.org!_D_DrvFPath!" if not exist "!__WD!inf.org!_D_DrvFPath!!_D_ActiveService!.sys" ( echo ;;^> copy "!__WD!system32\drivers\!_D_ActiveService!.sys" "!__WD!inf.org!_D_DrvFPath!!_D_ActiveService!.sys" copy "!__WD!system32\drivers\!_D_ActiveService!.sys" "!__WD!inf.org!_D_DrvFPath!!_D_ActiveService!.sys" ) ) endlocal ) echo.& echo ;; ---------------------------------------------------------------------------- set _D_Key=!__DK!!_D_ControlSet!\Control\CriticalDeviceDatabase set _D_KVD=Service rem reg query "!_D_Key!" /s /f "!_D_KVD!" /k rem reg query "!_D_Key!" /v "!_D_KVD!" /s rem reg query "!_D_Key!" /ve /s rem reg query "!_D_Key!" /s /f "!_D_KVD!" /d set _D_Service= for /F "usebackq skip=2 tokens=2* delims= " %%a in ( `reg query "!_D_Key!" /v "!_D_KVD!" /s 2^>nul` ) do if /I "%%~a"=="REG_SZ" ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" set _D_Service=%%~b rem echo. rem echo ;;* Service: %%~a "!_D_Service!" setlocal enabledelayedexpansion set _D_SMatch= for %%b in (%_D_LSMatch%) do ( if not "!_D_Service!"=="" if /I not "!_D_Service:%%~b=!"=="!_D_Service!" set _D_SMatch=%%~b ) if not "!_D_SMatch!"=="" ( echo. echo ;;* Service: %%~a "!_D_Service!" echo ;;. String Matched as the Filename: "!_D_SMatch!" ) if not "!_D_SMatch!"=="" ( if not exist "!__WD!system32\drivers\!_D_Service!.sys" ( echo ;;^> copy "!__DD!system32\drivers\!_D_Service!.sys" "!__WD!system32\drivers\!_D_Service!.sys" copy "!__DD!system32\drivers\!_D_Service!.sys" "!__WD!system32\drivers\!_D_Service!.sys" ) if not "!_D_DrvFPath!"=="\" set _D_DrvFPath=!_D_DrvFPath!\ if not exist "!__WD!inf.org!_D_DrvFPath!" md "!__WD!inf.org!_D_DrvFPath!" if not exist "!__WD!inf.org!_D_DrvFPath!!_D_Service!.sys" ( echo ;;^> copy "!__WD!system32\drivers\!_D_Service!.sys" "!__WD!inf.org!_D_DrvFPath!!_D_Service!.sys" copy "!__WD!system32\drivers\!_D_Service!.sys" "!__WD!inf.org!_D_DrvFPath!!_D_Service!.sys" ) ) endlocal ) echo.& echo ;; ---------------------------------------------------------------------------- ) ) if not exist "!__WD!reg.org\_MountedDevices\!__DP!MountedDevices.reg" ( echo. echo ;;^> reg export "!__DK!MountedDevices" "!__WD!reg.org\_MountedDevices\!__DP!MountedDevices.reg" /y reg export "!__DK!MountedDevices" "!__WD!reg.org\_MountedDevices\!__DP!MountedDevices.reg" /y ) if not exist "!__WD!reg.mod\_MountedDevices\!__DP!MountedDevices.reg" ( for /F "usebackq eol= skip=2 tokens=1* delims==" %%a in ( `type "!__WD!reg.org\_MountedDevices\!__DP!MountedDevices.reg"` ) do ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" if /I "%%~b"=="" ( echo.>> "!__WD!reg.mod\_MountedDevices\!__DP!MountedDevices.reg" echo %%~a>> "!__WD!reg.mod\_MountedDevices\!__DP!MountedDevices.reg" ) else ( set _D_Tmp0=%%b set _D_Tmp1=%%~a if not "!_D_Tmp0!"=="" if /I not "!_D_Tmp0:~-1!"=="\" ( if /I "!_D_Tmp1:~,14!"=="\\DosDevices\\" echo "%%~a"=%%b>> "!__WD!reg.mod\_MountedDevices\!__DP!MountedDevices.reg" ) set _D_Tmp0= set _D_Tmp1= ) ) ) if /I "!__DK!"=="HKLM\SYSTEM_X\" ( echo. echo ;;^> reg unload !__DK! reg unload !__DK! if exist "!__DD!system32\config\SYSTEM_!__DT!" if exist "!__DD!system32\config\SYSTEM" ( echo ;;^> del "!__DD!system32\config\SYSTEM" del "!__DD!system32\config\SYSTEM" ) echo ;;^> ren "!__DD!system32\config\SYSTEM_!__DT!" "SYSTEM" ren "!__DD!system32\config\SYSTEM_!__DT!" "SYSTEM" ) if not exist "!__WD!system32\UsbBootWatcher.exe" ( if exist "!__DD!system32\UsbBootWatcher.exe" ( echo. echo ;;^> copy "!__DD!system32\UsbBootWatcher.exe" "!__WD!system32\UsbBootWatcher.exe" copy "!__DD!system32\UsbBootWatcher.exe" "!__WD!system32\UsbBootWatcher.exe" ) else if exist "UsbBootWatcher\!_D_PROCESSOR_ARCHITECTURE!\UsbBootWatcher.exe" ( echo. echo ;;^> copy "UsbBootWatcher\!_D_PROCESSOR_ARCHITECTURE!\UsbBootWatcher.exe" "!__WD!system32\UsbBootWatcher.exe" copy "UsbBootWatcher\!_D_PROCESSOR_ARCHITECTURE!\UsbBootWatcher.exe" "!__WD!system32\UsbBootWatcher.exe" ) else if exist "!_D_PROCESSOR_ARCHITECTURE!\UsbBootWatcher.exe" ( echo. echo ;;^> copy "!_D_PROCESSOR_ARCHITECTURE!\UsbBootWatcher.exe" "!__WD!system32\UsbBootWatcher.exe" copy "!_D_PROCESSOR_ARCHITECTURE!\UsbBootWatcher.exe" "!__WD!system32\UsbBootWatcher.exe" ) ) echo REGEDIT4> "!__WD!reg.mod\_!__DP!ControlSet.reg" copy /B "!__WD!reg.mod\_!__DP!ControlSet.reg" + "!__WD!reg.mod\Control\CriticalDeviceDatabase\!__DP!*.reg" + "!__WD!reg.mod\services\!__DP!*.reg" "!__WD!reg.mod\_!__DP!ControlSet.reg" >nul if /I "!__DP!"=="S_" ( set _D_S2XReg=!__WD!reg.mod\_X_ControlSet.reg set _D_S2XKey=SYSTEM call :S2X set _D_S2XReg= set _D_S2XKey= ) else ( set _D_X2SReg=!__WD!reg.mod\_S_ControlSet.reg set _D_X2SKey=SYSTEM call :X2S set _D_X2SReg= set _D_X2SKey= ) if not exist "!__WD!reg.mod\_S_UsbBootWatcher.reg" ( echo REGEDIT4> "!__WD!reg.mod\_S_UsbBootWatcher.reg" echo.>> "!__WD!reg.mod\_S_UsbBootWatcher.reg" echo [HKEY_LOCAL_MACHINE\SYSTEM\!_D_SControlSet!\services\UsbBootWatcher]>> "!__WD!reg.mod\_S_UsbBootWatcher.reg" echo "ImagePath"="UsbBootWatcher.exe">> "!__WD!reg.mod\_S_UsbBootWatcher.reg" echo "ObjectName"="LocalSystem">> "!__WD!reg.mod\_S_UsbBootWatcher.reg" echo "DisplayName"="Usb Boot Watcher Service">> "!__WD!reg.mod\_S_UsbBootWatcher.reg" echo "ErrorControl"=dword:00000000>> "!__WD!reg.mod\_S_UsbBootWatcher.reg" echo "Start"=dword:00000002>> "!__WD!reg.mod\_S_UsbBootWatcher.reg" echo "Type"=dword:00000010>> "!__WD!reg.mod\_S_UsbBootWatcher.reg" echo ; CurrentControlSet\Services Subkey Entries>> "!__WD!reg.mod\_S_UsbBootWatcher.reg" echo ; http://support.microsoft.com/kb/103000/en>> "!__WD!reg.mod\_S_UsbBootWatcher.reg" echo ; Type 0x10 A Win32 program>> "!__WD!reg.mod\_S_UsbBootWatcher.reg" echo.>> "!__WD!reg.mod\_S_UsbBootWatcher.reg" echo [HKEY_LOCAL_MACHINE\SYSTEM\Setup\AllowStart\UsbBootWatcher]>> "!__WD!reg.mod\_S_UsbBootWatcher.reg" ) if not exist "!__WD!reg.mod\_X_UsbBootWatcher.reg" ( set _D_S2XReg=!__WD!reg.mod\_X_UsbBootWatcher.reg set _D_S2XKey=SYSTEM call :S2X set _D_S2XReg= set _D_S2XKey= ) if not exist "!__WD!reg.mod\_S_SOFTWARE.reg" ( echo REGEDIT4> "!__WD!reg.mod\_S_SOFTWARE.reg" echo.>> "!__WD!reg.mod\_S_SOFTWARE.reg" echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Dfrg\BootOptimizeFunction]>> "!__WD!reg.mod\_S_SOFTWARE.reg" echo "Enable"="N" ; "Y">> "!__WD!reg.mod\_S_SOFTWARE.reg" echo.>> "!__WD!reg.mod\_S_SOFTWARE.reg" echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\OptimalLayout]>> "!__WD!reg.mod\_S_SOFTWARE.reg" echo "EnableAutoLayout"=dword:00000000 ; dword:00000001>> "!__WD!reg.mod\_S_SOFTWARE.reg" ) if not exist "!__WD!reg.mod\_X_SOFTWARE.reg" ( set _D_S2XReg=!__WD!reg.mod\_X_SOFTWARE.reg set _D_S2XKey=SOFTWARE call :S2X set _D_S2XReg= set _D_S2XKey= ) if not exist "!__WD!reg.mod\_S_SYSTEM.reg" ( echo REGEDIT4> "!__WD!reg.mod\_S_SYSTEM.reg" echo.>> "!__WD!reg.mod\_S_SYSTEM.reg" echo [HKEY_LOCAL_MACHINE\SYSTEM\!_D_SControlSet!\Control\FileSystem]>> "!__WD!reg.mod\_S_SYSTEM.reg" echo "NtfsDisableLastAccessUpdate"=dword:00000001 ; dword:00000001>> "!__WD!reg.mod\_S_SYSTEM.reg" echo.>> "!__WD!reg.mod\_S_SYSTEM.reg" echo [HKEY_LOCAL_MACHINE\SYSTEM\!_D_SControlSet!\Control\Session Manager\Memory Management]>> "!__WD!reg.mod\_S_SYSTEM.reg" echo "ClearPageFileAtShutdown"=dword:00000000 ; dword:00000000>> "!__WD!reg.mod\_S_SYSTEM.reg" echo "DisablePagingExecutive"=dword:00000001 ; dword:00000000>> "!__WD!reg.mod\_S_SYSTEM.reg" echo.>> "!__WD!reg.mod\_S_SYSTEM.reg" echo [HKEY_LOCAL_MACHINE\SYSTEM\!_D_SControlSet!\Control\Session Manager\Memory Management\PrefetchParameters]>> "!__WD!reg.mod\_S_SYSTEM.reg" echo "EnablePrefetcher"=dword:00000000 ; dword:00000003>> "!__WD!reg.mod\_S_SYSTEM.reg" echo "EnableSuperfetch"=dword:00000000 ; dword:00000003>> "!__WD!reg.mod\_S_SYSTEM.reg" echo.>> "!__WD!reg.mod\_S_SYSTEM.reg" echo [HKEY_LOCAL_MACHINE\SYSTEM\!_D_SControlSet!\services\SysMain]>> "!__WD!reg.mod\_S_SYSTEM.reg" echo "Start"=dword:00000004 ; dword:00000002>> "!__WD!reg.mod\_S_SYSTEM.reg" echo ; Start/Stop Superfetch service in Windows 7 from Services, Regedit or CMD>> "!__WD!reg.mod\_S_SYSTEM.reg" echo ; http://computerstepbystep.com/superfetch_service.html>> "!__WD!reg.mod\_S_SYSTEM.reg" echo ; Start 0x2 Automatic>> "!__WD!reg.mod\_S_SYSTEM.reg" echo ; Start 0x3 Manual>> "!__WD!reg.mod\_S_SYSTEM.reg" echo ; Start 0x4 Disabled>> "!__WD!reg.mod\_S_SYSTEM.reg" ) if not exist "!__WD!reg.mod\_X_SYSTEM.reg" ( set _D_S2XReg=!__WD!reg.mod\_X_SYSTEM.reg set _D_S2XKey=SYSTEM call :S2X set _D_S2XReg= set _D_S2XKey= ) echo.& echo ;; ---------------------------------------------------------------------------- rem info if /I not "%CD%"=="%SystemDrive%\" ( rem if exist "!__WD!inf.s32\" rd /s /q "!__WD!inf.s32\" rem if exist "!__WD!inf.rep\" rd /s /q "!__WD!inf.rep\" rem if exist "!__WD!inf.org\_EXCLUDE.TXT" del "!__WD!inf.org\_EXCLUDE.TXT" ) else ( echo. echo ;;/ Error: Can't remove subdirectories on the directory "%CD%". goto :abort ) echo. if exist "!__WD!" echo Check "!__WD!" for Device class Drivers DisInstalled.>con :Inactive-Install if not "!__ID!"=="" ( if exist "!__WD!system32\drivers\*.sys" ( if /I "!__ID:~,2!"=="%SystemDrive%" ( set __KEY= set /P __KEY=Are you sure you want to install in the System Partition !__ID:~,2! [y,n]?>con if not "!__KEY!"=="y" goto :abort set __KEY= ) if exist "%SystemRoot%\System32\slmgr.vbs" ( set __STR= set __FLG= set __KEY= for /F "usebackq delims=" %%a in ( `cscript %SystemRoot%\System32\slmgr.vbs -dli` ) do ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" set __STR=%%a if not "!__STR!"=="" if /I not "!__STR!"=="!__STR:OEM_SLP=!" ( echo !__STR!>con set __FLG=1 ) ) if "!__FLG!"=="" ( rem Technical Details on Microsoft Product Activation for Windows XP rem http://technet.microsoft.com/en-us/library/bb457054.aspx#EFAA echo.>con echo The current system is not for "OEM_SLP channel".>con echo So, product activation may be required for the systems on external drives.>con set /P __KEY=Are you sure you want to continue this operation [y,n]?>con if not "!__KEY!"=="y" goto :abort ) set __STR= set __FLG= set __KEY= ) rem Exclude files for WindowsPE on HDD copy /Y nul "!__WD!_EXCLUDE.TXT" >nul rem dir /A /B "!__ID!system32\drivers\atapi.sys" >> "!__WD!_EXCLUDE.TXT" dir /A /B "!__ID!system32\drivers\*.sys" >> "!__WD!_EXCLUDE.TXT" echo ;;^> xcopy /D /E /I /H /R /K /Y /EXCLUDE:!__WD!_EXCLUDE.TXT "!__WD!system32" "!__ID!system32\" %1 xcopy /D /E /I /H /R /K /Y /EXCLUDE:!__WD!_EXCLUDE.TXT "!__WD!system32" "!__ID!system32\" if /I "!__IK!"=="HKLM\SYSTEM_X\" ( set __IT=%DATE:/=%_%TIME::=% set __IT=!__IT: =0! set __IT=!__IT:.=_! if exist "!__ID!system32\config\SYSTEM_!__IT!" if exist "!__ID!system32\config\SYSTEM" ( echo ;;^> del "!__ID!system32\config\SYSTEM_!__IT!" %1 del "!__ID!system32\config\SYSTEM_!__IT!" ) echo ;;^> ren "!__ID!system32\config\SYSTEM" "SYSTEM_!__IT!" %1 ren "!__ID!system32\config\SYSTEM" "SYSTEM_!__IT!" echo ;;^> copy "!__ID!system32\config\SYSTEM_!__IT!" "!__ID!system32\config\SYSTEM" %1 copy "!__ID!system32\config\SYSTEM_!__IT!" "!__ID!system32\config\SYSTEM" echo ;;^> reg load !__IK! "!__ID!system32\config\SYSTEM" %1 reg load !__IK! "!__ID!system32\config\SYSTEM" ) if "!__DD!"=="" ( if exist "!__WD!reg.mod\_MountedDevices\S_MountedDevices.reg" ( set __DP=S_ ) else if exist "!__WD!reg.mod\_MountedDevices\X_MountedDevices.reg" ( set __DP=X_ ) else ( set __DP= ) ) echo REGEDIT4> "!__WD!reg.mod\_!__DP!MountedDevices.reg" set _D_Flg0= set _D_Key=!__IK!MountedDevices for /F "usebackq eol= skip=1 tokens=1* delims==" %%a in ( `type "!__WD!reg.mod\_MountedDevices\!__DP!MountedDevices.reg"` ) do ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" if /I "%%~b"=="" ( echo.>> "!__WD!reg.mod\_!__DP!MountedDevices.reg" echo %%~a>> "!__WD!reg.mod\_!__DP!MountedDevices.reg" ) else ( set __DAT=%%~b if not "!__DAT!"=="" set __DAT=!__DAT:hex:=! if not "!__DAT!"=="" ( if /I "%%~a"=="\\DosDevices\\C:" ( set _D_KVD=\DosDevices\C: for /F "usebackq skip=2 tokens=2* delims= " %%a in ( `reg query "!_D_Key!" /v "!_D_KVD!" 2^>nul` ) do ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" if /I "%%~b"=="!__DAT:,=!" ( echo "\\DosDevices\\!__ID:~,2!"=hex:!__DAT! ; "\\DosDevices\\C:">> "!__WD!reg.mod\_!__DP!MountedDevices.reg" set _D_Flg0=!_D_Flg0!* ) ) ) else if /I "%%~a"=="\\DosDevices\\!__ID:~,2!" ( set _D_KVD=\DosDevices\!__ID:~,2! for /F "usebackq skip=2 tokens=2* delims= " %%a in ( `reg query "!_D_Key!" /v "!_D_KVD!" 2^>nul` ) do ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" if /I "%%~b"=="!__DAT:,=!" ( echo "\\DosDevices\\C:"=hex:!__DAT! ; "\\DosDevices\\!__ID:~,2!">> "!__WD!reg.mod\_!__DP!MountedDevices.reg" set _D_Flg0=!_D_Flg0!* ) ) ) ) ) ) if /I not "!_D_Flg0!"=="**" if exist "!__WD!reg.mod\_*MountedDevices.reg" del "!__WD!reg.mod\_*MountedDevices.reg" set _D_Flg0= set _D_Key= set _D_KVD= set __DAT= if /I "!__DP!"=="S_" ( set _D_S2XReg=!__WD!reg.mod\_X_MountedDevices.reg set _D_S2XKey=SYSTEM call :S2X set _D_S2XReg= set _D_S2XKey= ) else ( set _D_X2SReg=!__WD!reg.mod\_S_MountedDevices.reg set _D_X2SKey=SYSTEM call :X2S set _D_X2SReg= set _D_X2SKey= ) if exist "!__WD!reg.mod\_!__IP!MountedDevices.reg" ( echo ;;^> reg import "!__WD!reg.mod\_!__IP!MountedDevices.reg" %1 reg import "!__WD!reg.mod\_!__IP!MountedDevices.reg" 2>&1 ) else ( echo. echo ;;. Info: MountedDevices not modified echo. ) echo ;;^> reg import "!__WD!reg.mod\_!__IP!ControlSet.reg" %1 reg import "!__WD!reg.mod\_!__IP!ControlSet.reg" 2>&1 if exist "!__ID!system32\UsbBootWatcher.exe" ( echo ;;^> reg import "!__WD!reg.mod\_!__IP!UsbBootWatcher.reg" %1 reg import "!__WD!reg.mod\_!__IP!UsbBootWatcher.reg" 2>&1 ) if exist "!__WD!reg.mod\_!__IP!SYSTEM.reg" ( echo ;;^> reg import "!__WD!reg.mod\_!__IP!SYSTEM.reg" %1 reg import "!__WD!reg.mod\_!__IP!SYSTEM.reg" 2>&1 ) rem "AutoReboot" should be disabled to confirm Stop Error Code on BSoD (Blue Screen of Death). echo ;;^> reg add "!__IK!!_D_SControlSet!\Control\CrashControl" /v "AutoReboot" /t REG_DWORD /d 0x0 /f %1 reg add "!__IK!!_D_SControlSet!\Control\CrashControl" /v "AutoReboot" /t REG_DWORD /d 0x0 /f if /I "!__IK!"=="HKLM\SYSTEM_X\" ( echo ;;^> reg unload !__IK! %1 reg unload !__IK! rem if exist "!__ID!system32\config\SYSTEM_!__IT!" if exist "!__ID!system32\config\SYSTEM" ( rem echo ;;^> del "!__ID!system32\config\SYSTEM" rem %1 del "!__ID!system32\config\SYSTEM" rem ) rem echo ;;^> ren "!__ID!system32\config\SYSTEM_!__IT!" "SYSTEM" rem %1 ren "!__ID!system32\config\SYSTEM_!__IT!" "SYSTEM" ) if /I "!__IK!"=="HKLM\SYSTEM_X\" ( set __IT=%DATE:/=%_%TIME::=% set __IT=!__IT: =0! set __IT=!__IT:.=_! if exist "!__ID!system32\config\SOFTWARE_!__IT!" if exist "!__ID!system32\config\SOFTWARE" ( echo ;;^> del "!__ID!system32\config\SOFTWARE_!__IT!" %1 del "!__ID!system32\config\SOFTWARE_!__IT!" ) echo ;;^> ren "!__ID!system32\config\SOFTWARE" "SOFTWARE_!__IT!" %1 ren "!__ID!system32\config\SOFTWARE" "SOFTWARE_!__IT!" echo ;;^> copy "!__ID!system32\config\SOFTWARE_!__IT!" "!__ID!system32\config\SOFTWARE" %1 copy "!__ID!system32\config\SOFTWARE_!__IT!" "!__ID!system32\config\SOFTWARE" echo ;;^> reg load !__IK:SYSTEM=SOFTWARE! "!__ID!system32\config\SOFTWARE" %1 reg load !__IK:SYSTEM=SOFTWARE! "!__ID!system32\config\SOFTWARE" ) if exist "!__WD!reg.mod\_!__IP!SOFTWARE.reg" ( echo ;;^> reg import "!__WD!reg.mod\_!__IP!SOFTWARE.reg" %1 reg import "!__WD!reg.mod\_!__IP!SOFTWARE.reg" 2>&1 ) if /I "!__IK!"=="HKLM\SYSTEM_X\" ( echo ;;^> reg unload !__IK:SYSTEM=SOFTWARE! %1 reg unload !__IK:SYSTEM=SOFTWARE! rem if exist "!__ID!system32\config\SOFTWARE_!__IT!" if exist "!__ID!system32\config\SOFTWARE" ( rem echo ;;^> del "!__ID!system32\config\SOFTWARE" rem %1 del "!__ID!system32\config\SOFTWARE" rem ) rem echo ;;^> ren "!__ID!system32\config\SOFTWARE_!__IT!" "SOFTWARE" rem %1 ren "!__ID!system32\config\SOFTWARE_!__IT!" "SOFTWARE" ) ) else ( echo. echo ;;/ Error: Can't Inactive-Install from "!__WD!". goto :abort ) echo. if exist "!__ID!system32\" echo Check "!__ID!system32\" etc. for Device class Drivers Inactive-Installed.>con ) if exist "%~n0.log" echo Check "%~n0.log" for %~n0.>con echo Done: %~n0 goto :exit :abort echo. echo Aborted: %~n0 endlocal rem pause exit /B 1 :exit endlocal rem pause exit /B 0 :IncludedDrvs setlocal enabledelayedexpansion if not "!_D_IncludedInfs!"=="" set _D_IncludedInfs=!_D_IncludedInfs:\0= ! if not "!_D_IncludedInfs!"=="" set _D_IncludedInfs=!_D_IncludedInfs:,=/! for %%a in (!_D_IncludedInfs!) do ( for /F "tokens=1* delims=/" %%b in ("%%~a") do ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" set _D_IncludedInfs-s=%%~b rem echo ;;. Is "!_D_IncludedInfs-s!" if exist "!__WD!inf.s32\!_D_IncludedInfs-s!" ( set _D_SctD= set _D_SctN= for /F "usebackq eol=; tokens=1* delims== " %%a in ("!__WD!inf.s32\!_D_IncludedInfs-s!") do ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" set _D_Fld0=%%~a if not "!_D_Fld0!"=="" if /I "!_D_Fld0:~,1!"=="[" ( set _D_SctN=!_D_Fld0! ) rem echo !_D_SctN! "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" rem Using Dirids (Windows Drivers) rem http://msdn.microsoft.com/en-us/library/windows/hardware/ff553598(v=vs.85).aspx rem Dirid 12 Drivers directory. if /I "!_D_Fld0!"=="ServiceBinary" if /I "%%~b"=="%%12%%\!_D_Service!.sys" ( rem echo ;;. !_D_SctN! "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" set _D_SctD=!_D_SctN! if not "!_D_SctD!"=="" set _D_SctD=!_D_SctD:.AddService=.Dev.NT! ) ) set _D_LSct= set _D_SctN= for /F "usebackq eol=; tokens=1* delims== " %%a in ("!__WD!inf.s32\!_D_IncludedInfs-s!") do ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" set _D_Fld0=%%~a if not "!_D_Fld0!"=="" if /I "!_D_Fld0:~,1!"=="[" ( set _D_SctN=!_D_Fld0! ) rem echo !_D_SctN! "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" if /I "!_D_SctN!"=="!_D_SctD!" if /I "!_D_Fld0!"=="CopyFiles" ( set _D_LSct=%%~b if not "!_D_LSct!"=="" set _D_LSct=!_D_LSct:,= ! ) for %%a in (!_D_LSct!) do ( if /I "!_D_SctN!"=="[%%~a]" if not "!_D_Fld0!"=="" if /I not "!_D_Fld0:~,1!"=="[" ( for /F "tokens=1* delims=. " %%a in ("!_D_Fld0!") do ( rem echo ;;. !_D_SctN! "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" set _D_Service=%%~a if not exist "!__WD!system32\drivers\!_D_Service!.sys" ( echo ;;^> copy "!__DD!system32\drivers\!_D_Service!.sys" "!__WD!system32\drivers\!_D_Service!.sys" copy "!__DD!system32\drivers\!_D_Service!.sys" "!__WD!system32\drivers\!_D_Service!.sys" ) if not exist "!__WD!inf.org\!_D_Service!.sys" ( echo ;;^> copy "!__WD!system32\drivers\!_D_Service!.sys" "!__WD!inf.org\!_D_Service!.sys" copy "!__WD!system32\drivers\!_D_Service!.sys" "!__WD!inf.org\!_D_Service!.sys" ) if /I not "!_D_Service!"=="%_D_Service%" call :IncludedDrvs ) ) ) ) ) ) ) endlocal goto :eof :S2X setlocal enabledelayedexpansion if not "!_D_S2XReg!"=="" if /I not "!_D_S2XReg!"=="!_D_S2XReg:_X_=_S_!" if exist "!_D_S2XReg:_X_=_S_!" if not "!_D_S2XKey!"=="" ( if exist "!_D_S2XReg!" del "!_D_S2XReg!" for /F "usebackq eol= delims=" %%a in ("!_D_S2XReg:_X_=_S_!") do ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" set _D_Fld0=%%a if not "!_D_Fld0!"=="" ( if /I "!_D_Fld0:~,1!"=="[" ( echo.>> "!_D_S2XReg!" rem echo !_D_Fld0!>> "!_D_S2XReg!" for %%a in (!_D_S2XKey!) do ( echo !_D_Fld0:[HKEY_LOCAL_MACHINE\%%~a\=[HKEY_LOCAL_MACHINE\%%~a_X\!>> "!_D_S2XReg!" ) ) else ( echo !_D_Fld0!>> "!_D_S2XReg!" ) ) ) ) endlocal goto :eof :X2S setlocal enabledelayedexpansion if not "!_D_X2SReg!"=="" if /I not "!_D_X2SReg!"=="!_D_X2SReg:_S_=_X_!" if exist "!_D_X2SReg:_S_=_X_!" if not "!_D_X2SKey!"=="" ( if exist "!_D_X2SReg!" del "!_D_X2SReg!" for /F "usebackq eol= delims=" %%a in ("!_D_X2SReg:_S_=_X_!") do ( rem echo "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" set _D_Fld0=%%a if not "!_D_Fld0!"=="" ( if /I "!_D_Fld0:~,1!"=="[" ( echo.>> "!_D_X2SReg!" rem echo !_D_Fld0!>> "!_D_X2SReg!" for %%a in (!_D_X2SKey!) do ( echo !_D_Fld0:[HKEY_LOCAL_MACHINE\%%~a_X\=[HKEY_LOCAL_MACHINE\%%~a\!>> "!_D_X2SReg!" ) ) else ( echo !_D_Fld0!>> "!_D_X2SReg!" ) ) ) ) endlocal goto :eof :eof