diff --git a/Fix edgegdi.dll.bat b/Fix edgegdi.dll.bat index 302ba9153c4cba15d71e661fb36251ab8ac80c53..bdb7249281c48723ea6461bf7c719179173fa57f 100644 --- a/Fix edgegdi.dll.bat +++ b/Fix edgegdi.dll.bat @@ -1,4 +1,33 @@ @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 ) + +:getPrivileges +if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges) + +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 /B + +: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" diff --git a/Fix long login times.bat b/Fix long login times.bat index fe104b7075b55e23242e53e3373e2ee19abd1dd7..425647e1ea4a549de1a2bafa5422bc81d4941a7a 100644 --- a/Fix long login times.bat +++ b/Fix long login times.bat @@ -1,13 +1,42 @@ @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 ) + +:getPrivileges +if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges) + +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 /B + +: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 - ) + 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 ) diff --git a/Fix printer installation error 0x00000bcb.bat b/Fix printer installation error 0x00000bcb.bat new file mode 100644 index 0000000000000000000000000000000000000000..f8c2d9413157b762720717253aaa528dc270f0f0 --- /dev/null +++ b/Fix printer installation error 0x00000bcb.bat @@ -0,0 +1,41 @@ +@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 ) + +:getPrivileges +if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges) + +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 /B + +:gotPrivileges +if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul & shift /1) + + +REM Functional part +echo Adding temporary registry hack. . . +reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Printers\PointAndPrint" /v "RestrictDriverInstallationToAdministrators" /t REG_DWORD /d 0 /f +echo. +echo Add your printer the usual way now. +pause +echo. +echo TRemoving registry hack again. . . +reg delete "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Printers\PointAndPrint" /v "RestrictDriverInstallationToAdministrators" /f +echo Done. +pause +exit diff --git a/Fix printer not install- and selectable.bat b/Fix printer not install- and selectable.bat index 17659baee3a59067af12173c7a7ce2b9f3a1e349..4a1bee40474a70be8d88c67ca32e1a04362a80cd 100644 --- a/Fix printer not install- and selectable.bat +++ b/Fix printer not install- and selectable.bat @@ -1,4 +1,33 @@ @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 ) + +:getPrivileges +if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges) + +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 /B + +: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" diff --git a/Fix work file not createable.bat b/Fix work file not createable.bat index 30484324933b09d0e9ecbcb790c28ee1c186ebfa..09f466b07292b1175b9d8e895ead9854770292e6 100644 --- a/Fix work file not createable.bat +++ b/Fix work file not createable.bat @@ -1,4 +1,33 @@ @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 ) + +:getPrivileges +if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges) + +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 /B + +:gotPrivileges +if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul & shift /1) + + +REM Functional part echo Create backups of registry entries to delete in Downloads folder. . . reg export "HKCR\CLSID\{84F66100-FF7C-4fb4-B0C0-02CD7FB668FE}" "%userprofile%\Downloads\SBLOG_RegBackup_WordPreview.reg" reg export "HKCR\CLSID\{65235197-874B-4A07-BDC5-E65EA825B718}" "%userprofile%\documents\SBLOG_RegBackup_PowerPointreview.reg" diff --git a/README.md b/README.md index 1aee39a937f183f8469dc13c8c79c77123911642..e739597a39657694a0ad89a09b985e2035293b7a 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,12 @@ # Windows error fixing scripts A collection of scripts to fix various errors cropping up in Windows.\ -These are made for double-click execution via file explorer. +These are made for running via double-clicking the scripts in file explorer. * `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 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. diff --git a/Remove Java remains.bat b/Remove Java remains.bat index 6850d10eb65436dea6638bd8298c3082a1614c18..faae327bf028b7a0ee1bd02ebb9982dad7c13ef4 100644 --- a/Remove Java remains.bat +++ b/Remove Java remains.bat @@ -1,4 +1,33 @@ @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 ) + +:getPrivileges +if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges) + +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 /B + +: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 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