From 0e357b5715516b2e4388984773af068778c77ee6 Mon Sep 17 00:00:00 2001 From: JG <it@hgw-tornesch.de> Date: Thu, 6 Oct 2022 14:13:11 +0200 Subject: [PATCH] Apparently, the cool kids use .cmd since 2012 or sth. The reasons I've read up on and even though they are so minor in 2022 that I really shouldn't care, I am very obedient to conventions and rules - and I wanna be a cool kid, too. --- ... folder.bat => Fix Outlook Temp folder.cmd | 10 +-- Fix blank icons.bat => Fix blank icons.cmd | 76 ++++++++-------- Fix edgegdi.dll.bat => Fix edgegdi.dll.cmd | 88 +++++++++--------- ...ogin times.bat => Fix long login times.cmd | 90 +++++++++---------- ... printer installation error 0x00000bcb.cmd | 0 ...ix printer not install- and selectable.cmd | 80 ++++++++--------- ....bat => Fix prompt for password change.cmd | 0 ...ettings.bat => Fix search and settings.cmd | 0 ...le.bat => Fix work file not createable.cmd | 0 README.md | 22 ++--- ...ava remains.bat => Remove Java remains.cmd | 0 ...elper.bat => Windows activation helper.cmd | 10 +-- 12 files changed, 188 insertions(+), 188 deletions(-) rename Fix Outlook Temp folder.bat => Fix Outlook Temp folder.cmd (94%) rename Fix blank icons.bat => Fix blank icons.cmd (96%) rename Fix edgegdi.dll.bat => Fix edgegdi.dll.cmd (97%) rename Fix long login times.bat => Fix long login times.cmd (96%) rename Fix printer installation error 0x00000bcb.bat => Fix printer installation error 0x00000bcb.cmd (100%) rename Fix printer not install- and selectable.bat => Fix printer not install- and selectable.cmd (96%) rename Fix prompt for password change.bat => Fix prompt for password change.cmd (100%) rename Fix search and settings.bat => Fix search and settings.cmd (100%) rename Fix work file not createable.bat => Fix work file not createable.cmd (100%) rename Remove Java remains.bat => Remove Java remains.cmd (100%) rename Windows activation helper.bat => Windows activation helper.cmd (96%) diff --git a/Fix Outlook Temp folder.bat b/Fix Outlook Temp folder.cmd similarity index 94% rename from Fix Outlook Temp folder.bat rename to Fix Outlook Temp folder.cmd index 88bdf9a..c804656 100644 --- a/Fix Outlook Temp folder.bat +++ b/Fix Outlook Temp folder.cmd @@ -1,5 +1,5 @@ -@echo off -del /Q /F %localappdata%\Temp\* -echo Outlook Temp folder cleared. -pause -exit +@echo off +del /Q /F %localappdata%\Temp\* +echo Outlook Temp folder cleared. +pause +exit diff --git a/Fix blank icons.bat b/Fix blank icons.cmd similarity index 96% rename from Fix blank icons.bat rename to Fix blank icons.cmd index 0e8fcc2..62a20c6 100644 --- a/Fix blank icons.bat +++ b/Fix blank icons.cmd @@ -1,38 +1,38 @@ -@echo off -set iconcache=%localappdata%\IconCache.db -set iconcache_x=%localappdata%\Microsoft\Windows\Explorer\iconcache* - -echo. -echo The explorer process must be temporarily killed before deleting the IconCache.db file. -echo Please SAVE ALL OPEN WORK before continuing. -echo. -pause -echo. -If exist "%iconcache%" goto delete -echo The %localappdata%\IconCache.db file has already been deleted. -echo. -If exist "%iconcache_x%" goto delete -echo The %localappdata%\Microsoft\Windows\Explorer\IconCache_*.db files have already been deleted. -echo. -exit /B - -:delete -echo Attempting to delete IconCache.db files... -echo. -ie4uinit.exe -show -taskkill /IM explorer.exe /F -If exist del /A /F /Q "%iconcache%" -If exist del /A /F /Q "%iconcache_x%" -start explorer.exe -echo IconCache database files have been successfully deleted. -echo. -echo You will need to restart the PC to finish rebuilding your icon cache. -CHOICE /C:YN /M "Do you want to restart the PC now?" -IF ERRORLEVEL 2 goto no -IF ERRORLEVEL 1 goto yes - -:yes -shutdown /r /f /t 00 - -:no -exit +@echo off +set iconcache=%localappdata%\IconCache.db +set iconcache_x=%localappdata%\Microsoft\Windows\Explorer\iconcache* + +echo. +echo The explorer process must be temporarily killed before deleting the IconCache.db file. +echo Please SAVE ALL OPEN WORK before continuing. +echo. +pause +echo. +If exist "%iconcache%" goto delete +echo The %localappdata%\IconCache.db file has already been deleted. +echo. +If exist "%iconcache_x%" goto delete +echo The %localappdata%\Microsoft\Windows\Explorer\IconCache_*.db files have already been deleted. +echo. +exit /B + +:delete +echo Attempting to delete IconCache.db files... +echo. +ie4uinit.exe -show +taskkill /IM explorer.exe /F +If exist del /A /F /Q "%iconcache%" +If exist del /A /F /Q "%iconcache_x%" +start explorer.exe +echo IconCache database files have been successfully deleted. +echo. +echo You will need to restart the PC to finish rebuilding your icon cache. +CHOICE /C:YN /M "Do you want to restart the PC now?" +IF ERRORLEVEL 2 goto no +IF ERRORLEVEL 1 goto yes + +:yes +shutdown /r /f /t 00 + +:no +exit diff --git a/Fix edgegdi.dll.bat b/Fix edgegdi.dll.cmd similarity index 97% rename from Fix edgegdi.dll.bat rename to Fix edgegdi.dll.cmd index 16cb899..01ad5f5 100644 --- a/Fix edgegdi.dll.bat +++ b/Fix edgegdi.dll.cmd @@ -1,44 +1,44 @@ -@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 -robocopy "C:\Windows\SysWOW64" "%localappdata%\Temp" EdgeManager.dll -ren "%localappdata%\Temp\EdgeManager.dll" "edgegdi.dll" -robocopy "%localappdata%\Temp" "C:\Windows\SysWOW64" "edgegdi.dll" -del "%localappdata%\Temp\edgegdi.dll" - - -robocopy "C:\Windows\System32" "%localappdata%\Temp" EdgeManager.dll -ren "%localappdata%\Temp\EdgeManager.dll" "edgegdi.dll" -robocopy "%localappdata%\Temp" "C:\Windows\System32" "edgegdi.dll" -del "%localappdata%\Temp\edgegdi.dll" - -echo Done. -pause -exit +@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 +robocopy "C:\Windows\SysWOW64" "%localappdata%\Temp" EdgeManager.dll +ren "%localappdata%\Temp\EdgeManager.dll" "edgegdi.dll" +robocopy "%localappdata%\Temp" "C:\Windows\SysWOW64" "edgegdi.dll" +del "%localappdata%\Temp\edgegdi.dll" + + +robocopy "C:\Windows\System32" "%localappdata%\Temp" EdgeManager.dll +ren "%localappdata%\Temp\EdgeManager.dll" "edgegdi.dll" +robocopy "%localappdata%\Temp" "C:\Windows\System32" "edgegdi.dll" +del "%localappdata%\Temp\edgegdi.dll" + +echo Done. +pause +exit diff --git a/Fix long login times.bat b/Fix long login times.cmd similarity index 96% rename from Fix long login times.bat rename to Fix long login times.cmd index b5807c3..6e8364a 100644 --- a/Fix long login times.bat +++ b/Fix long login times.cmd @@ -1,45 +1,45 @@ -@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 -pushd "C:\Users" && ( -for /f "tokens=*" %%a in ('dir /A:D /b') do ( - if not "%%a" == "Public" if not "%%a" == "All Users" if not "%%a" == "Default User" ( - pushd "C:\Users\%%a\AppData\Local\Microsoft\Windows" && ( - rd /s /q WebCache - del /q /f WebCacheLock.dat -) - popd -) -) -popd -) -echo Done. -pause -exit +@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 +pushd "C:\Users" && ( +for /f "tokens=*" %%a in ('dir /A:D /b') do ( + if not "%%a" == "Public" if not "%%a" == "All Users" if not "%%a" == "Default User" ( + pushd "C:\Users\%%a\AppData\Local\Microsoft\Windows" && ( + rd /s /q WebCache + del /q /f WebCacheLock.dat +) + popd +) +) +popd +) +echo Done. +pause +exit diff --git a/Fix printer installation error 0x00000bcb.bat b/Fix printer installation error 0x00000bcb.cmd similarity index 100% rename from Fix printer installation error 0x00000bcb.bat rename to Fix printer installation error 0x00000bcb.cmd diff --git a/Fix printer not install- and selectable.bat b/Fix printer not install- and selectable.cmd similarity index 96% rename from Fix printer not install- and selectable.bat rename to Fix printer not install- and selectable.cmd index 373be57..15e6776 100644 --- a/Fix printer not install- and selectable.bat +++ b/Fix printer not install- and selectable.cmd @@ -1,40 +1,40 @@ -@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 -net stop spooler -pushd "%~dp0\ScriptFiles\PrinterNotInstallable" && ( -reg import "Printer Spooler Registry.reg" -robocopy spool C:\Windows\System32\spool * -) -popd -net start spooler -echo Done. -pause -exit +@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 +net stop spooler +pushd "%~dp0\ScriptFiles\PrinterNotInstallable" && ( +reg import "Printer Spooler Registry.reg" +robocopy spool C:\Windows\System32\spool * +) +popd +net start spooler +echo Done. +pause +exit diff --git a/Fix prompt for password change.bat b/Fix prompt for password change.cmd similarity index 100% rename from Fix prompt for password change.bat rename to Fix prompt for password change.cmd diff --git a/Fix search and settings.bat b/Fix search and settings.cmd similarity index 100% rename from Fix search and settings.bat rename to Fix search and settings.cmd diff --git a/Fix work file not createable.bat b/Fix work file not createable.cmd similarity index 100% rename from Fix work file not createable.bat rename to Fix work file not createable.cmd diff --git a/README.md b/README.md index 372cfe8..35d74da 100644 --- a/README.md +++ b/README.md @@ -3,15 +3,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 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 and settings.bat` fixes the windows search and the settings app not starting up correctly and freezing. +* `Fix Outlook Temp folder.cmd` empties the Temp folder of MS Office Outlook to fix it filling up the main harddrive. +* `Fix blank icons.cmd` 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.cmd` fixes the `edgegdi.dll` not being available for certain tasks, leading to errors thrown. +* `Fix long login times.cmd` 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.cmd` adds a temporary registry hack to fix error 0x00000bcb during printer install, then removes it again afterwards. +* `Fix printer not install- and selectable.cmd` fixes a problem where no printer can be selected or even installed, caused by corrupted files. +* `Fix prompt for password change.cmd` disables the prompting for a password change when using a Microsoft account. +* `Fix search and settings.cmd` 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. -* `Windows activation helper.bat` shows you the product key of your current Windows installation to potentially resolve activation issues. \ No newline at end of file +* `Fix work file not createable.cmd` fixes the "Could not create the work file" error in Office. +* `Remove Java remains.cmd` removes remains of a Java installation after uninstall. +* `Windows activation helper.cmd` shows you the product key of your current Windows installation to potentially resolve activation issues. \ No newline at end of file diff --git a/Remove Java remains.bat b/Remove Java remains.cmd similarity index 100% rename from Remove Java remains.bat rename to Remove Java remains.cmd diff --git a/Windows activation helper.bat b/Windows activation helper.cmd similarity index 96% rename from Windows activation helper.bat rename to Windows activation helper.cmd index 140d58c..cc1836f 100644 --- a/Windows activation helper.bat +++ b/Windows activation helper.cmd @@ -1,5 +1,5 @@ -@echo off -echo Input the following key at "Activate/Change Key": -wmic path softwarelicensingservice get OA3xOriginalProductKey -pause -exit +@echo off +echo Input the following key at "Activate/Change Key": +wmic path softwarelicensingservice get OA3xOriginalProductKey +pause +exit -- GitLab