From 4d4aa33ca1d9192e50879b35c797e59d2c734264 Mon Sep 17 00:00:00 2001 From: gyk <147011991+gyk4j@users.noreply.github.com> Date: Tue, 14 May 2024 09:25:10 +0800 Subject: [PATCH] Refactor registry key writing (#16) --- chcl3.cmd | 19 ++++++------------- data/registry.txt | 6 ++++++ 2 files changed, 12 insertions(+), 13 deletions(-) create mode 100644 data/registry.txt diff --git a/chcl3.cmd b/chcl3.cmd index 2d7bd4f..48041bd 100644 --- a/chcl3.cmd +++ b/chcl3.cmd @@ -49,19 +49,12 @@ for /f %%A IN (data\files.txt) DO ( ) echo. -echo # Disabling Customer Experience Improvement Program (CEIP)... -REG ADD "HKLM\SOFTWARE\Microsoft\SQMClient\Windows" /v CEIPEnable /t REG_DWORD /d 0 /f -echo. - -echo # Disabling Windows Error Reporting... -REG ADD "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting" /v Disabled /t REG_DWORD /d 1 /f -REG ADD "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting" /v DontShowUI /t REG_DWORD /d 1 /f -echo. - -echo # Disabling Windows Updates... -REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v AUOptions /t REG_DWORD /d 1 /f -REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v IncludeRecommendedUpdates /t REG_DWORD /d 0 /f -REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v ElevateNonAdmins /t REG_DWORD /d 0 /f +echo # Updating registry key values... +for /f "delims=, tokens=1,2,3,4" %%A IN (data\registry.txt) DO ( + ECHO [%%A] + ECHO %%B = %%D [%%C] + REG ADD "%%A" /v %%B /t %%C /d %%D /f +) echo. echo # Disabling scheduled tasks... diff --git a/data/registry.txt b/data/registry.txt new file mode 100644 index 0000000..bc3033f --- /dev/null +++ b/data/registry.txt @@ -0,0 +1,6 @@ +HKLM\SOFTWARE\Microsoft\SQMClient\Windows,CEIPEnable,REG_DWORD,0 +HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting,Disabled,REG_DWORD,1 +HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting,DontShowUI,REG_DWORD,1 +HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update,AUOptions,REG_DWORD,1 +HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update,IncludeRecommendedUpdates,REG_DWORD,0 +HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update,ElevateNonAdmins,REG_DWORD,0