From e6af2d07377ed72d87e73ae5d44f2bb1f0d2f002 Mon Sep 17 00:00:00 2001
From: JG <it@hgw-tornesch.de>
Date: Tue, 9 Aug 2022 11:31:44 +0200
Subject: [PATCH] Added Cortana & search disabling & improved auto elevation
 prompting Also renamed search and setting fix because of incompatibility
 using "&".

---
 Disable Cortana & start menu Bing search.reg  |  7 ++++
 Fix blank icons.bat                           |  2 +-
 Fix edgegdi.dll.bat                           | 14 ++++----
 Fix long login times.bat                      | 18 +++++-----
 Fix printer installation error 0x00000bcb.bat | 16 ++++-----
 Fix printer not install- and selectable.bat   | 14 ++++----
 Fix prompt for password change.bat            | 29 +++++++++++++++
 Fix search & settings.bat                     |  6 ----
 Fix search and settings.bat                   | 35 +++++++++++++++++++
 Fix work file not createable.bat              | 18 +++++-----
 README.md                                     |  5 +--
 Remove Java remains.bat                       | 17 ++++-----
 12 files changed, 124 insertions(+), 57 deletions(-)
 create mode 100644 Disable Cortana & start menu Bing search.reg
 delete mode 100644 Fix search & settings.bat
 create mode 100644 Fix search and settings.bat

diff --git a/Disable Cortana & start menu Bing search.reg b/Disable Cortana & start menu Bing search.reg
new file mode 100644
index 0000000..2370970
--- /dev/null
+++ b/Disable Cortana & start menu Bing search.reg	
@@ -0,0 +1,7 @@
+Windows Registry Editor Version 5.00
+
+[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Explorer]
+"DisableSearchBoxSuggestions"=dword:00000001
+
+[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Windows Search]
+"AllowCortana"=dword:00000000
\ No newline at end of file
diff --git a/Fix blank icons.bat b/Fix blank icons.bat
index 4766b8e..0e8fcc2 100644
--- a/Fix blank icons.bat	
+++ b/Fix blank icons.bat	
@@ -35,4 +35,4 @@ IF ERRORLEVEL 1 goto yes
 shutdown /r /f /t 00
 
 :no
-exit /B
+exit
diff --git a/Fix edgegdi.dll.bat b/Fix edgegdi.dll.bat
index bdb7249..16cb899 100644
--- a/Fix edgegdi.dll.bat	
+++ b/Fix edgegdi.dll.bat	
@@ -1,19 +1,19 @@
 @echo off
 REM Ensure Admin rights
-:init
 setlocal DisableDelayedExpansion
 set "batchPath=%~0"
 for %%k in (%0) do set batchName=%%~nk
 set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs"
 setlocal EnableDelayedExpansion
-
-:checkPrivileges
-NET FILE 1>nul 2>nul
-if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges )
+net file 1>nul 2>nul
+if '%errorlevel%' == '0' (goto gotPrivileges) else (goto getPrivileges)
 
 :getPrivileges
 if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges)
-
+REM If you have non-ASCII chars in your path you'll need to set the codepage appropriate to your locale:
+REM chcp 1252
+REM (ANSI-Latin1 - Western European, e.g. German)
+cls
 echo Set UAC = CreateObject^("Shell.Application"^) > "%vbsGetPrivileges%"
 echo args = "ELEV " >> "%vbsGetPrivileges%"
 echo For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%"
@@ -21,7 +21,7 @@ echo args = args ^& strArg ^& " " >> "%vbsGetPrivileges%"
 echo Next >> "%vbsGetPrivileges%"
 echo UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%"
 "%SystemRoot%\System32\WScript.exe" "%vbsGetPrivileges%" %*
-exit /B
+exit
 
 :gotPrivileges
 if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul & shift /1)
diff --git a/Fix long login times.bat b/Fix long login times.bat
index 425647e..b5807c3 100644
--- a/Fix long login times.bat	
+++ b/Fix long login times.bat	
@@ -1,19 +1,19 @@
 @echo off
 REM Ensure Admin rights
-:init
 setlocal DisableDelayedExpansion
 set "batchPath=%~0"
 for %%k in (%0) do set batchName=%%~nk
 set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs"
 setlocal EnableDelayedExpansion
-
-:checkPrivileges
-NET FILE 1>nul 2>nul
-if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges )
+net file 1>nul 2>nul
+if '%errorlevel%' == '0' (goto gotPrivileges) else (goto getPrivileges)
 
 :getPrivileges
 if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges)
-
+REM If you have non-ASCII chars in your path you'll need to set the codepage appropriate to your locale:
+REM chcp 1252
+REM (ANSI-Latin1 - Western European, e.g. German)
+cls
 echo Set UAC = CreateObject^("Shell.Application"^) > "%vbsGetPrivileges%"
 echo args = "ELEV " >> "%vbsGetPrivileges%"
 echo For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%"
@@ -21,7 +21,7 @@ echo args = args ^& strArg ^& " " >> "%vbsGetPrivileges%"
 echo Next >> "%vbsGetPrivileges%"
 echo UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%"
 "%SystemRoot%\System32\WScript.exe" "%vbsGetPrivileges%" %*
-exit /B
+exit
 
 :gotPrivileges
 if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul & shift /1)
@@ -34,9 +34,9 @@ for /f "tokens=*" %%a in ('dir /A:D /b') do (
  pushd "C:\Users\%%a\AppData\Local\Microsoft\Windows" && (
   rd /s /q WebCache
   del /q /f WebCacheLock.dat
- )
+)
  popd
- )
+)
 )
 popd
 )
diff --git a/Fix printer installation error 0x00000bcb.bat b/Fix printer installation error 0x00000bcb.bat
index f8c2d94..b6cf747 100644
--- a/Fix printer installation error 0x00000bcb.bat	
+++ b/Fix printer installation error 0x00000bcb.bat	
@@ -1,19 +1,19 @@
 @echo off
 REM Ensure Admin rights
-:init
 setlocal DisableDelayedExpansion
 set "batchPath=%~0"
 for %%k in (%0) do set batchName=%%~nk
 set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs"
 setlocal EnableDelayedExpansion
-
-:checkPrivileges
-NET FILE 1>nul 2>nul
-if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges )
+net file 1>nul 2>nul
+if '%errorlevel%' == '0' (goto gotPrivileges) else (goto getPrivileges)
 
 :getPrivileges
 if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges)
-
+REM If you have non-ASCII chars in your path you'll need to set the codepage appropriate to your locale:
+REM chcp 1252
+REM (ANSI-Latin1 - Western European, e.g. German)
+cls
 echo Set UAC = CreateObject^("Shell.Application"^) > "%vbsGetPrivileges%"
 echo args = "ELEV " >> "%vbsGetPrivileges%"
 echo For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%"
@@ -21,7 +21,7 @@ echo args = args ^& strArg ^& " " >> "%vbsGetPrivileges%"
 echo Next >> "%vbsGetPrivileges%"
 echo UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%"
 "%SystemRoot%\System32\WScript.exe" "%vbsGetPrivileges%" %*
-exit /B
+exit
 
 :gotPrivileges
 if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul & shift /1)
@@ -34,7 +34,7 @@ echo.
 echo Add your printer the usual way now.
 pause
 echo.
-echo TRemoving registry hack again. . .
+echo Removing registry hack again. . .
 reg delete "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Printers\PointAndPrint" /v "RestrictDriverInstallationToAdministrators" /f
 echo Done.
 pause
diff --git a/Fix printer not install- and selectable.bat b/Fix printer not install- and selectable.bat
index 4a1bee4..373be57 100644
--- a/Fix printer not install- and selectable.bat	
+++ b/Fix printer not install- and selectable.bat	
@@ -1,19 +1,19 @@
 @echo off
 REM Ensure Admin rights
-:init
 setlocal DisableDelayedExpansion
 set "batchPath=%~0"
 for %%k in (%0) do set batchName=%%~nk
 set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs"
 setlocal EnableDelayedExpansion
-
-:checkPrivileges
-NET FILE 1>nul 2>nul
-if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges )
+net file 1>nul 2>nul
+if '%errorlevel%' == '0' (goto gotPrivileges) else (goto getPrivileges)
 
 :getPrivileges
 if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges)
-
+REM If you have non-ASCII chars in your path you'll need to set the codepage appropriate to your locale:
+REM chcp 1252
+REM (ANSI-Latin1 - Western European, e.g. German)
+cls
 echo Set UAC = CreateObject^("Shell.Application"^) > "%vbsGetPrivileges%"
 echo args = "ELEV " >> "%vbsGetPrivileges%"
 echo For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%"
@@ -21,7 +21,7 @@ echo args = args ^& strArg ^& " " >> "%vbsGetPrivileges%"
 echo Next >> "%vbsGetPrivileges%"
 echo UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%"
 "%SystemRoot%\System32\WScript.exe" "%vbsGetPrivileges%" %*
-exit /B
+exit
 
 :gotPrivileges
 if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul & shift /1)
diff --git a/Fix prompt for password change.bat b/Fix prompt for password change.bat
index 398de67..7c84ace 100644
--- a/Fix prompt for password change.bat	
+++ b/Fix prompt for password change.bat	
@@ -1,4 +1,33 @@
 @echo off
+REM Ensure Admin rights
+setlocal DisableDelayedExpansion
+set "batchPath=%~0"
+for %%k in (%0) do set batchName=%%~nk
+set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs"
+setlocal EnableDelayedExpansion
+net file 1>nul 2>nul
+if '%errorlevel%' == '0' (goto gotPrivileges) else (goto getPrivileges)
+
+:getPrivileges
+if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges)
+REM If you have non-ASCII chars in your path you'll need to set the codepage appropriate to your locale:
+REM chcp 1252
+REM (ANSI-Latin1 - Western European, e.g. German)
+cls
+echo Set UAC = CreateObject^("Shell.Application"^) > "%vbsGetPrivileges%"
+echo args = "ELEV " >> "%vbsGetPrivileges%"
+echo For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%"
+echo args = args ^& strArg ^& " " >> "%vbsGetPrivileges%"
+echo Next >> "%vbsGetPrivileges%"
+echo UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%"
+"%SystemRoot%\System32\WScript.exe" "%vbsGetPrivileges%" %*
+exit
+
+:gotPrivileges
+if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul & shift /1)
+
+
+REM Functional part
 wmic UserAccount set PasswordExpires=False
 pause
 exit
diff --git a/Fix search & settings.bat b/Fix search & settings.bat
deleted file mode 100644
index 24b3801..0000000
--- a/Fix search & settings.bat	
+++ /dev/null
@@ -1,6 +0,0 @@
-@echo off
-rd /s /q "%localappdata%\Packages\windows.immersivecontrolpanel_cw5n1h2txyewy"
-robocopy /e "C:\Users\Administrator\AppData\Local\Packages\windows.immersivecontrolpanel_cw5n1h2txyewy" "%localappdata%\Packages\windows.immersivecontrolpanel_cw5n1h2txyewy"
-echo Done.
-pause
-exit
diff --git a/Fix search and settings.bat b/Fix search and settings.bat
new file mode 100644
index 0000000..c765fea
--- /dev/null
+++ b/Fix search and settings.bat	
@@ -0,0 +1,35 @@
+@echo off
+REM Ensure Admin rights
+setlocal DisableDelayedExpansion
+set "batchPath=%~0"
+for %%k in (%0) do set batchName=%%~nk
+set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs"
+setlocal EnableDelayedExpansion
+net file 1>nul 2>nul
+if '%errorlevel%' == '0' (goto gotPrivileges) else (goto getPrivileges)
+
+:getPrivileges
+if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges)
+REM If you have non-ASCII chars in your path you'll need to set the codepage appropriate to your locale:
+REM chcp 1252
+REM (ANSI-Latin1 - Western European, e.g. German)
+cls
+echo Set UAC = CreateObject^("Shell.Application"^) > "%vbsGetPrivileges%"
+echo args = "ELEV " >> "%vbsGetPrivileges%"
+echo For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%"
+echo args = args ^& strArg ^& " " >> "%vbsGetPrivileges%"
+echo Next >> "%vbsGetPrivileges%"
+echo UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%"
+"%SystemRoot%\System32\WScript.exe" "%vbsGetPrivileges%" %*
+exit
+
+:gotPrivileges
+if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul & shift /1)
+
+
+REM Functional part
+rd /s /q "%localappdata%\Packages\windows.immersivecontrolpanel_cw5n1h2txyewy"
+robocopy /e "C:\Users\Administrator\AppData\Local\Packages\windows.immersivecontrolpanel_cw5n1h2txyewy" "%localappdata%\Packages\windows.immersivecontrolpanel_cw5n1h2txyewy"
+echo Done.
+pause
+exit
diff --git a/Fix work file not createable.bat b/Fix work file not createable.bat
index 09f466b..d99763f 100644
--- a/Fix work file not createable.bat	
+++ b/Fix work file not createable.bat	
@@ -1,19 +1,19 @@
 @echo off
 REM Ensure Admin rights
-:init
 setlocal DisableDelayedExpansion
 set "batchPath=%~0"
 for %%k in (%0) do set batchName=%%~nk
 set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs"
 setlocal EnableDelayedExpansion
-
-:checkPrivileges
-NET FILE 1>nul 2>nul
-if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges )
+net file 1>nul 2>nul
+if '%errorlevel%' == '0' (goto gotPrivileges) else (goto getPrivileges)
 
 :getPrivileges
 if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges)
-
+REM If you have non-ASCII chars in your path you'll need to set the codepage appropriate to your locale:
+REM chcp 1252
+REM (ANSI-Latin1 - Western European, e.g. German)
+cls
 echo Set UAC = CreateObject^("Shell.Application"^) > "%vbsGetPrivileges%"
 echo args = "ELEV " >> "%vbsGetPrivileges%"
 echo For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%"
@@ -21,7 +21,7 @@ echo args = args ^& strArg ^& " " >> "%vbsGetPrivileges%"
 echo Next >> "%vbsGetPrivileges%"
 echo UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%"
 "%SystemRoot%\System32\WScript.exe" "%vbsGetPrivileges%" %*
-exit /B
+exit
 
 :gotPrivileges
 if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul & shift /1)
@@ -39,8 +39,8 @@ reg delete "HKCR\CLSID\{65235197-874B-4A07-BDC5-E65EA825B718}" /f
 reg delete "HKCR\CLSID\{00020827-0000-0000-C000-000000000046}" /f
 echo.
 echo Creating needed folders. . .
-mkdir "%USERPROFILE%\AppData\Local\Microsoft\Windows\INetCache\Content.Word"
-mkdir "%USERPROFILE%\AppData\Local\Microsoft\Windows\INetCacheContent.Word"
+mkdir "%USERPROfile%\AppData\Local\Microsoft\Windows\INetCache\Content.Word"
+mkdir "%USERPROfile%\AppData\Local\Microsoft\Windows\INetCacheContent.Word"
 echo.
 echo Defining new registry entries for chache path. . .
 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "Cache" /t REG_SZ /d "%userprofile%\AppData\Local\Microsoft\Windows\INetCache" /f
diff --git a/README.md b/README.md
index e739597..372cfe8 100644
--- a/README.md
+++ b/README.md
@@ -2,14 +2,15 @@
 A collection of scripts to fix various errors cropping up in Windows.\
 These are made for running via double-clicking the scripts in file explorer.
 
+* `Disable Cortana & start menu Bing search.reg` disables the use of Cortana and the start menu searching on the internet via Bing for all users.
 * `Fix Outlook Temp folder.bat` empties the Temp folder of MS Office Outlook to fix it filling up the main harddrive.
-* `Fix blank icons` fixes desktop icons appearing as blank white rectangles instead of their usual icon. Adapted from the [ElevenForums](https://www.elevenforum.com/t/rebuild-icon-cache-in-windows-11.2049/) ([Archived Version](https://web.archive.org/web/20211017173532/https://www.elevenforum.com/t/rebuild-icon-cache-in-windows-11.2049/))
+* `Fix blank icons` fixes desktop icons appearing as blank white rectangles instead of their usual icon. Adapted from the [ElevenForums](https://www.elevenforum.com/t/rebuild-icon-cache-in-windows-11.2049/) [[Archived link](https://web.archive.org/web/20211017173532/https://www.elevenforum.com/t/rebuild-icon-cache-in-windows-11.2049/)]
 * `Fix edgegdi.dll.bat` fixes the `edgegdi.dll` not being available for certain tasks, leading to errors thrown.
 * `Fix long login times.bat` deletes `WebCache`and `WebCacheLock.dat` on all normal users to fix unbearable login times after installing windows through a custom made image.
 * `Fix printer installation error 0x00000bcb.bat` adds a temporary registry hack to fix error 0x00000bcb during printer install, then removes it again afterwards.
 * `Fix printer not install- and selectable.bat` fixes a problem where no printer can be selected or even installed, caused by corrupted files.
 * `Fix prompt for password change.bat` disables the prompting for a password change when using a Microsoft account.
-* `Fix search & settings.bat` fixes the windows search and the settings app not starting up correctly and freezing.
+* `Fix search and settings.bat` fixes the windows search and the settings app not starting up correctly and freezing.
 * `Fix winmail.dat - Disable RTF & TNEF.reg` fixes the receiver of an email getting a `winmail.dat` file as attachment instead of a normal file by introducing a registry fix to keep Outlook from ever sending emails in RTF format or TNEF encryption.
 * `Fix work file not createable.bat` fixes the "Could not create the work file" error in Office.
 * `Remove Java remains.bat` removes remains of a Java installation after uninstall.
diff --git a/Remove Java remains.bat b/Remove Java remains.bat
index faae327..479270a 100644
--- a/Remove Java remains.bat	
+++ b/Remove Java remains.bat	
@@ -1,19 +1,19 @@
 @echo off
 REM Ensure Admin rights
-:init
 setlocal DisableDelayedExpansion
 set "batchPath=%~0"
 for %%k in (%0) do set batchName=%%~nk
 set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs"
 setlocal EnableDelayedExpansion
-
-:checkPrivileges
-NET FILE 1>nul 2>nul
-if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges )
+net file 1>nul 2>nul
+if '%errorlevel%' == '0' (goto gotPrivileges) else (goto getPrivileges)
 
 :getPrivileges
 if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges)
-
+REM If you have non-ASCII chars in your path you'll need to set the codepage appropriate to your locale:
+REM chcp 1252
+REM (ANSI-Latin1 - Western European, e.g. German)
+cls
 echo Set UAC = CreateObject^("Shell.Application"^) > "%vbsGetPrivileges%"
 echo args = "ELEV " >> "%vbsGetPrivileges%"
 echo For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%"
@@ -21,14 +21,15 @@ echo args = args ^& strArg ^& " " >> "%vbsGetPrivileges%"
 echo Next >> "%vbsGetPrivileges%"
 echo UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%"
 "%SystemRoot%\System32\WScript.exe" "%vbsGetPrivileges%" %*
-exit /B
+exit
 
 :gotPrivileges
 if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul & shift /1)
 
 
 REM Functional part
-del "C:\Program Files (x86)\Common Files\Java\*" /s /q /f
+rd /s /q "C:\Program Files (x86)\Common Files\Java\"
+rd /s /q "C:\Program Files\Common Files\Java\"
 reg query hklm\software\classes\installer\products /f "java(tm) 7" /s | find "HKEY_LOCAL_MACHINE" > deljava.txt
 for /f "tokens=* delims= " %%a in (deljava.txt) do reg delete %%a /f
 del deljava.txt
-- 
GitLab