From 40dd4ad53cd512c3e1042de447d5d5d73ebb5a6a Mon Sep 17 00:00:00 2001 From: Xyueta Date: Fri, 6 Oct 2023 20:27:59 +0200 Subject: [PATCH] fix: hide any redundant errors --- src/playbook/Executables/FINALIZE.cmd | 8 ++++---- src/playbook/Executables/STARTMENU.cmd | 4 ++-- src/playbook/Executables/TASKBARPINS.cmd | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/playbook/Executables/FINALIZE.cmd b/src/playbook/Executables/FINALIZE.cmd index 7cc023b78f..2a32fea317 100644 --- a/src/playbook/Executables/FINALIZE.cmd +++ b/src/playbook/Executables/FINALIZE.cmd @@ -56,7 +56,7 @@ for /f %%a in ('wmic path Win32_NetworkAdapter get GUID ^| findstr "{"') do ( :: Set network adapter driver registry key for /f %%a in ('wmic path Win32_NetworkAdapter get PNPDeviceID^| findstr /L "PCI\VEN_"') do ( - for /f "tokens=3" %%b in ('reg query "HKLM\SYSTEM\CurrentControlSet\Enum\%%a" /v "Driver"') do ( + for /f "tokens=3" %%b in ('reg query "HKLM\SYSTEM\CurrentControlSet\Enum\%%a" /v "Driver" 2^>nul') do ( set "netKey=HKLM\SYSTEM\CurrentControlSet\Control\Class\%%b" ) ) @@ -133,11 +133,11 @@ for %%a in ( "WoWLANS5Support" ) do ( rem Check without '*' - for /f %%b in ('reg query "!netKey!" /v "%%~a" ^| findstr "HKEY"') do ( + for /f %%b in ('reg query "!netKey!" /v "%%~a" 2^>nul ^| findstr "HKEY" 2^>nul') do ( reg add "!netKey!" /v "%%~a" /t REG_SZ /d "0" /f > nul ) rem Check with '*' - for /f %%b in ('reg query "!netKey!" /v "*%%~a" ^| findstr "HKEY"') do ( + for /f %%b in ('reg query "!netKey!" /v "*%%~a" 2^>nul ^| findstr "HKEY" 2^>nul') do ( reg add "!netKey!" /v "*%%~a" /t REG_SZ /d "0" /f > nul ) ) @@ -209,7 +209,7 @@ if "!diskDrive!" == "SSD" ( ) :: Detect if user uses laptop device or personal computer -for /f "delims=:{}" %%a in ('wmic path Win32_SystemEnclosure get ChassisTypes ^| findstr [0-9]') do set "CHASSIS=%%a"] +for /f "delims=:{}" %%a in ('wmic path Win32_SystemEnclosure get ChassisTypes ^| findstr [0-9]') do set "CHASSIS=%%a" set "DEVICE_TYPE=PC" for %%a in (8 9 10 11 12 13 14 18 21 30 31 32) do if "!CHASSIS!" == "%%a" (set "DEVICE_TYPE=LAPTOP") diff --git a/src/playbook/Executables/STARTMENU.cmd b/src/playbook/Executables/STARTMENU.cmd index eae8997799..62dbbd0ece 100644 --- a/src/playbook/Executables/STARTMENU.cmd +++ b/src/playbook/Executables/STARTMENU.cmd @@ -5,7 +5,7 @@ copy /y "Layout.xml" "%SystemDrive%\Users\Default\AppData\Local\Microsoft\Window :: If the "Volatile Environment" key exists, that means it is a proper user. Built in accounts/SIDs don't have this key. for /f "usebackq tokens=2 delims=\" %%a in (`reg query "HKEY_USERS" ^| findstr /r /x /c:"HKEY_USERS\\S-.*" /c:"HKEY_USERS\\AME_UserHive_[^_]*"`) do ( reg query "HKEY_USERS\%%a" | findstr /c:"Volatile Environment" /c:"AME_UserHive_" > nul && ( - for /f "usebackq tokens=4* delims= " %%c in (`reg query "HKU\%%a\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "Local AppData" ^| findstr /r /x /c:".*Local AppData[ ]*REG_SZ[ ].*"`) do ( + for /f "usebackq tokens=4* delims= " %%c in (`reg query "HKU\%%a\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "Local AppData" 2^>nul ^| findstr /r /x /c:".*Local AppData[ ]*REG_SZ[ ].*" 2^>nul`) do ( copy /y "Layout.xml" "%%c\Microsoft\Windows\Shell\LayoutModification.xml" > nul rem Clear Start Menu pinned items @@ -15,7 +15,7 @@ for /f "usebackq tokens=2 delims=\" %%a in (`reg query "HKEY_USERS" ^| findstr / ) ) ) - for /f "usebackq delims=" %%c in (`reg query "HKU\%%a\SOFTWARE\Microsoft\Windows\CurrentVersion\CloudStore\Store\Cache\DefaultAccount" ^| findstr /c:"start.tilegrid"`) do ( + for /f "usebackq delims=" %%c in (`reg query "HKU\%%a\SOFTWARE\Microsoft\Windows\CurrentVersion\CloudStore\Store\Cache\DefaultAccount" 2^>nul ^| findstr /c:"start.tilegrid" 2^>nul`) do ( reg delete "%%c" /f > nul 2>&1 ) ) diff --git a/src/playbook/Executables/TASKBARPINS.cmd b/src/playbook/Executables/TASKBARPINS.cmd index 36c6664e02..5f26583bd7 100644 --- a/src/playbook/Executables/TASKBARPINS.cmd +++ b/src/playbook/Executables/TASKBARPINS.cmd @@ -15,7 +15,7 @@ if exist "%ProgramFiles(x86)%\Microsoft\Edge\Application\msedge.exe" ( :: If the "Volatile Environment" key exists, that means it is a proper user. Built in accounts/SIDs don't have this key. for /f "usebackq tokens=2 delims=\" %%a in (`reg query "HKEY_USERS" ^| findstr /r /x /c:"HKEY_USERS\\S-.*" /c:"HKEY_USERS\\AME_UserHive_[^_]*"`) do ( reg query "HKEY_USERS\%%a" | findstr /c:"Volatile Environment" /c:"AME_UserHive_" > nul && ( - for /f "usebackq tokens=3* delims= " %%b in (`reg query "HKU\%%a\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "AppData" ^| findstr /r /x /c:".*AppData[ ]*REG_SZ[ ].*"`) do ( + for /f "usebackq tokens=3* delims= " %%b in (`reg query "HKU\%%a\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "AppData" 2^>nul ^| findstr /r /x /c:".*AppData[ ]*REG_SZ[ ].*" 2^>nul`) do ( rmdir /s /q "%%b\%taskBarLocation%" > nul mkdir "%%b\%taskBarLocation%" > nul copy /y "Shortcuts\File Explorer.lnk" "%%b\%taskBarLocation%" > nul