Skip to content
Snippets Groups Projects
Commit e6af2d07 authored by JG's avatar JG
Browse files

Added Cortana & search disabling & improved auto elevation prompting

Also renamed search and setting fix because of incompatibility using "&".
parent ada133f9
No related branches found
No related tags found
No related merge requests found
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
...@@ -35,4 +35,4 @@ IF ERRORLEVEL 1 goto yes ...@@ -35,4 +35,4 @@ IF ERRORLEVEL 1 goto yes
shutdown /r /f /t 00 shutdown /r /f /t 00
:no :no
exit /B exit
@echo off @echo off
REM Ensure Admin rights REM Ensure Admin rights
:init
setlocal DisableDelayedExpansion setlocal DisableDelayedExpansion
set "batchPath=%~0" set "batchPath=%~0"
for %%k in (%0) do set batchName=%%~nk for %%k in (%0) do set batchName=%%~nk
set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs" set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs"
setlocal EnableDelayedExpansion setlocal EnableDelayedExpansion
net file 1>nul 2>nul
:checkPrivileges
NET FILE 1>nul 2>nul
if '%errorlevel%' == '0' (goto gotPrivileges) else (goto getPrivileges) if '%errorlevel%' == '0' (goto gotPrivileges) else (goto getPrivileges)
:getPrivileges :getPrivileges
if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges) 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 Set UAC = CreateObject^("Shell.Application"^) > "%vbsGetPrivileges%"
echo args = "ELEV " >> "%vbsGetPrivileges%" echo args = "ELEV " >> "%vbsGetPrivileges%"
echo For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%" echo For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%"
...@@ -21,7 +21,7 @@ echo args = args ^& strArg ^& " " >> "%vbsGetPrivileges%" ...@@ -21,7 +21,7 @@ echo args = args ^& strArg ^& " " >> "%vbsGetPrivileges%"
echo Next >> "%vbsGetPrivileges%" echo Next >> "%vbsGetPrivileges%"
echo UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%" echo UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%"
"%SystemRoot%\System32\WScript.exe" "%vbsGetPrivileges%" %* "%SystemRoot%\System32\WScript.exe" "%vbsGetPrivileges%" %*
exit /B exit
:gotPrivileges :gotPrivileges
if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul & shift /1) if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul & shift /1)
......
@echo off @echo off
REM Ensure Admin rights REM Ensure Admin rights
:init
setlocal DisableDelayedExpansion setlocal DisableDelayedExpansion
set "batchPath=%~0" set "batchPath=%~0"
for %%k in (%0) do set batchName=%%~nk for %%k in (%0) do set batchName=%%~nk
set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs" set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs"
setlocal EnableDelayedExpansion setlocal EnableDelayedExpansion
net file 1>nul 2>nul
:checkPrivileges
NET FILE 1>nul 2>nul
if '%errorlevel%' == '0' (goto gotPrivileges) else (goto getPrivileges) if '%errorlevel%' == '0' (goto gotPrivileges) else (goto getPrivileges)
:getPrivileges :getPrivileges
if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges) 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 Set UAC = CreateObject^("Shell.Application"^) > "%vbsGetPrivileges%"
echo args = "ELEV " >> "%vbsGetPrivileges%" echo args = "ELEV " >> "%vbsGetPrivileges%"
echo For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%" echo For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%"
...@@ -21,7 +21,7 @@ echo args = args ^& strArg ^& " " >> "%vbsGetPrivileges%" ...@@ -21,7 +21,7 @@ echo args = args ^& strArg ^& " " >> "%vbsGetPrivileges%"
echo Next >> "%vbsGetPrivileges%" echo Next >> "%vbsGetPrivileges%"
echo UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%" echo UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%"
"%SystemRoot%\System32\WScript.exe" "%vbsGetPrivileges%" %* "%SystemRoot%\System32\WScript.exe" "%vbsGetPrivileges%" %*
exit /B exit
:gotPrivileges :gotPrivileges
if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul & shift /1) if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul & shift /1)
......
@echo off @echo off
REM Ensure Admin rights REM Ensure Admin rights
:init
setlocal DisableDelayedExpansion setlocal DisableDelayedExpansion
set "batchPath=%~0" set "batchPath=%~0"
for %%k in (%0) do set batchName=%%~nk for %%k in (%0) do set batchName=%%~nk
set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs" set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs"
setlocal EnableDelayedExpansion setlocal EnableDelayedExpansion
net file 1>nul 2>nul
:checkPrivileges
NET FILE 1>nul 2>nul
if '%errorlevel%' == '0' (goto gotPrivileges) else (goto getPrivileges) if '%errorlevel%' == '0' (goto gotPrivileges) else (goto getPrivileges)
:getPrivileges :getPrivileges
if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges) 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 Set UAC = CreateObject^("Shell.Application"^) > "%vbsGetPrivileges%"
echo args = "ELEV " >> "%vbsGetPrivileges%" echo args = "ELEV " >> "%vbsGetPrivileges%"
echo For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%" echo For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%"
...@@ -21,7 +21,7 @@ echo args = args ^& strArg ^& " " >> "%vbsGetPrivileges%" ...@@ -21,7 +21,7 @@ echo args = args ^& strArg ^& " " >> "%vbsGetPrivileges%"
echo Next >> "%vbsGetPrivileges%" echo Next >> "%vbsGetPrivileges%"
echo UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%" echo UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%"
"%SystemRoot%\System32\WScript.exe" "%vbsGetPrivileges%" %* "%SystemRoot%\System32\WScript.exe" "%vbsGetPrivileges%" %*
exit /B exit
:gotPrivileges :gotPrivileges
if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul & shift /1) if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul & shift /1)
...@@ -34,7 +34,7 @@ echo. ...@@ -34,7 +34,7 @@ echo.
echo Add your printer the usual way now. echo Add your printer the usual way now.
pause pause
echo. echo.
echo TRemoving registry hack again. . . echo Removing registry hack again. . .
reg delete "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Printers\PointAndPrint" /v "RestrictDriverInstallationToAdministrators" /f reg delete "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Printers\PointAndPrint" /v "RestrictDriverInstallationToAdministrators" /f
echo Done. echo Done.
pause pause
......
@echo off @echo off
REM Ensure Admin rights REM Ensure Admin rights
:init
setlocal DisableDelayedExpansion setlocal DisableDelayedExpansion
set "batchPath=%~0" set "batchPath=%~0"
for %%k in (%0) do set batchName=%%~nk for %%k in (%0) do set batchName=%%~nk
set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs" set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs"
setlocal EnableDelayedExpansion setlocal EnableDelayedExpansion
net file 1>nul 2>nul
:checkPrivileges
NET FILE 1>nul 2>nul
if '%errorlevel%' == '0' (goto gotPrivileges) else (goto getPrivileges) if '%errorlevel%' == '0' (goto gotPrivileges) else (goto getPrivileges)
:getPrivileges :getPrivileges
if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges) 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 Set UAC = CreateObject^("Shell.Application"^) > "%vbsGetPrivileges%"
echo args = "ELEV " >> "%vbsGetPrivileges%" echo args = "ELEV " >> "%vbsGetPrivileges%"
echo For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%" echo For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%"
...@@ -21,7 +21,7 @@ echo args = args ^& strArg ^& " " >> "%vbsGetPrivileges%" ...@@ -21,7 +21,7 @@ echo args = args ^& strArg ^& " " >> "%vbsGetPrivileges%"
echo Next >> "%vbsGetPrivileges%" echo Next >> "%vbsGetPrivileges%"
echo UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%" echo UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%"
"%SystemRoot%\System32\WScript.exe" "%vbsGetPrivileges%" %* "%SystemRoot%\System32\WScript.exe" "%vbsGetPrivileges%" %*
exit /B exit
:gotPrivileges :gotPrivileges
if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul & shift /1) if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul & shift /1)
......
@echo off @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 wmic UserAccount set PasswordExpires=False
pause pause
exit exit
@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
@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
@echo off @echo off
REM Ensure Admin rights REM Ensure Admin rights
:init
setlocal DisableDelayedExpansion setlocal DisableDelayedExpansion
set "batchPath=%~0" set "batchPath=%~0"
for %%k in (%0) do set batchName=%%~nk for %%k in (%0) do set batchName=%%~nk
set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs" set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs"
setlocal EnableDelayedExpansion setlocal EnableDelayedExpansion
net file 1>nul 2>nul
:checkPrivileges
NET FILE 1>nul 2>nul
if '%errorlevel%' == '0' (goto gotPrivileges) else (goto getPrivileges) if '%errorlevel%' == '0' (goto gotPrivileges) else (goto getPrivileges)
:getPrivileges :getPrivileges
if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges) 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 Set UAC = CreateObject^("Shell.Application"^) > "%vbsGetPrivileges%"
echo args = "ELEV " >> "%vbsGetPrivileges%" echo args = "ELEV " >> "%vbsGetPrivileges%"
echo For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%" echo For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%"
...@@ -21,7 +21,7 @@ echo args = args ^& strArg ^& " " >> "%vbsGetPrivileges%" ...@@ -21,7 +21,7 @@ echo args = args ^& strArg ^& " " >> "%vbsGetPrivileges%"
echo Next >> "%vbsGetPrivileges%" echo Next >> "%vbsGetPrivileges%"
echo UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%" echo UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%"
"%SystemRoot%\System32\WScript.exe" "%vbsGetPrivileges%" %* "%SystemRoot%\System32\WScript.exe" "%vbsGetPrivileges%" %*
exit /B exit
:gotPrivileges :gotPrivileges
if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul & shift /1) 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 ...@@ -39,8 +39,8 @@ reg delete "HKCR\CLSID\{65235197-874B-4A07-BDC5-E65EA825B718}" /f
reg delete "HKCR\CLSID\{00020827-0000-0000-C000-000000000046}" /f reg delete "HKCR\CLSID\{00020827-0000-0000-C000-000000000046}" /f
echo. echo.
echo Creating needed folders. . . echo Creating needed folders. . .
mkdir "%USERPROFILE%\AppData\Local\Microsoft\Windows\INetCache\Content.Word" mkdir "%USERPROfile%\AppData\Local\Microsoft\Windows\INetCache\Content.Word"
mkdir "%USERPROFILE%\AppData\Local\Microsoft\Windows\INetCacheContent.Word" mkdir "%USERPROfile%\AppData\Local\Microsoft\Windows\INetCacheContent.Word"
echo. echo.
echo Defining new registry entries for chache path. . . 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 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "Cache" /t REG_SZ /d "%userprofile%\AppData\Local\Microsoft\Windows\INetCache" /f
......
...@@ -2,14 +2,15 @@ ...@@ -2,14 +2,15 @@
A collection of scripts to fix various errors cropping up in Windows.\ 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. 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 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 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 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 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 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 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 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. * `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. * `Remove Java remains.bat` removes remains of a Java installation after uninstall.
......
@echo off @echo off
REM Ensure Admin rights REM Ensure Admin rights
:init
setlocal DisableDelayedExpansion setlocal DisableDelayedExpansion
set "batchPath=%~0" set "batchPath=%~0"
for %%k in (%0) do set batchName=%%~nk for %%k in (%0) do set batchName=%%~nk
set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs" set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs"
setlocal EnableDelayedExpansion setlocal EnableDelayedExpansion
net file 1>nul 2>nul
:checkPrivileges
NET FILE 1>nul 2>nul
if '%errorlevel%' == '0' (goto gotPrivileges) else (goto getPrivileges) if '%errorlevel%' == '0' (goto gotPrivileges) else (goto getPrivileges)
:getPrivileges :getPrivileges
if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges) 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 Set UAC = CreateObject^("Shell.Application"^) > "%vbsGetPrivileges%"
echo args = "ELEV " >> "%vbsGetPrivileges%" echo args = "ELEV " >> "%vbsGetPrivileges%"
echo For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%" echo For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%"
...@@ -21,14 +21,15 @@ echo args = args ^& strArg ^& " " >> "%vbsGetPrivileges%" ...@@ -21,14 +21,15 @@ echo args = args ^& strArg ^& " " >> "%vbsGetPrivileges%"
echo Next >> "%vbsGetPrivileges%" echo Next >> "%vbsGetPrivileges%"
echo UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%" echo UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%"
"%SystemRoot%\System32\WScript.exe" "%vbsGetPrivileges%" %* "%SystemRoot%\System32\WScript.exe" "%vbsGetPrivileges%" %*
exit /B exit
:gotPrivileges :gotPrivileges
if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul & shift /1) if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul & shift /1)
REM Functional part 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 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 for /f "tokens=* delims= " %%a in (deljava.txt) do reg delete %%a /f
del deljava.txt del deljava.txt
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment