-
-
Notifications
You must be signed in to change notification settings - Fork 707
Expand file tree
/
Copy pathEnable Search Indexing.cmd
More file actions
66 lines (56 loc) · 2.02 KB
/
Enable Search Indexing.cmd
File metadata and controls
66 lines (56 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
@echo off
set "settingName=Indexing"
set "stateValue=2"
set "scriptPath=%~f0"
set indexConfPath="%windir%\AtlasModules\Scripts\indexConf.cmd"
set "silentMode=0"
echo %* | findstr /i /c:"/silent" /c:"-silent" /c:"/quiet" > nul 2>&1 && set "silentMode=1"
if "%silentMode%"=="1" (
fltmc > nul 2>&1 || (
call RunAsTI.cmd "%~f0" %*
exit /b
)
) else (
whoami /user | find /i "S-1-5-18" > nul 2>&1 || (
call RunAsTI.cmd "%~f0" %*
exit /b
)
)
if not exist "%indexConfPath%" (
echo The 'indexConf.cmd' script wasn't found in AtlasModules.
pause
exit /b 1
)
set "indexConf=call %indexConfPath%"
reg add "HKLM\SOFTWARE\AtlasOS\Services\%settingName%" /v state /t REG_DWORD /d %stateValue% /f > nul
reg add "HKLM\SOFTWARE\AtlasOS\Services\%settingName%" /v path /t REG_SZ /d "%scriptPath%" /f > nul
echo.
echo Enabling full search indexing...
%indexConf% /stop
%indexConf% /cleanpolicies
%indexConf% /include "%programdata%\Microsoft\Windows\Start Menu\Programs"
%indexConf% /include "%windir%\AtlasDesktop"
%indexConf% /include "%systemdrive%\Users"
:: Add default user exclusions
for /f "usebackq delims=" %%a in (`dir /b /a:d "%SystemDrive%\Users"`) do (
for %%z in (
"AppData"
"MicrosoftEdgeBackups"
) do (
if exist "%SystemDrive%\Users\%%~a\%%~z" %indexConf% /exclude "%SystemDrive%\Users\%%~a\%%~z"
)
)
%indexConf% /start
reg add "HKLM\SOFTWARE\Microsoft\Windows Search" /v SetupCompletedSuccessfully /t REG_DWORD /d 0 /f > nul
set regCmd=^>nul reg add "HKLM\Software\Microsoft\Windows Search\Gather\Windows\SystemIndex" /v "RespectPowerModes" /t REG_DWORD /d
if "%silentMode%"=="1" (%regCmd% "0" /f & exit /b)
echo.
:: Respect Power Settings when Search Indexing to prevent performance loss during gaming or battery drain
choice /c:yn /n /m "Would you like to have indexing disable itself when on battery or gaming? [Y/N] "
if %errorlevel%==1 %regCmd% "1" /f
if %errorlevel%==2 %regCmd% "0" /f
echo.
echo Full Search Indexing has been enabled.
echo Press any key to exit...
pause > nul
exit /b