I have received several emails asking for the batch script to disable and enable
Cortana on Windows 10 that was available in the forum.
You can download it here
Alternatively, copy the code below, paste it into a text editor
and save it with a .bat extension e.g. Disable or Enable Cortana.bat.
This script may need to be run a few times to disable Cortana.
If you get ownership or file in use by another process errors be sure to read the comments in the script.
@ECHO OFF TITLE Disable/Enable Cortana - by rediSoft COLOR 0A REM set the paths to the Cortana directory and the disabled Cortana directory SET DisabledDir=%SYSTEMROOT%\SystemApps\DISABLED.Microsoft.Windows.Cortana_cw5n1h2txyewy SET EnabledDir=%SYSTEMROOT%\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy REM Make sure we are running on Windows 10 SETLOCAL FOR /f "tokens=4-5 delims=. " %%i IN ('ver') DO SET VERSION=%%i.%%j IF "%version%" == "10.0" (GOTO :CheckAdmin) IF "%version%" == "6.3" (GOTO :NotSupported) IF "%version%" == "6.2" (GOTO :NotSupported) IF "%version%" == "6.1" (GOTO :NotSupported) IF "%version%" == "6.0" (GOTO :NotSupported) ENDLOCAL REM Check script is being run with admin rights :CheckAdmin NET session >NUL 2>&1 IF %ERRORLEVEL% == 0 ( (GOTO :Win10) ) ELSE ( COLOR 0C ECHO Please run this script as an Administrator by ECHO right-clicking it and choosing 'Run as administrator'. ECHO. ) PAUSE EXIT REM Windows 10 not detected :NotSupported COLOR 0C ECHO Cortana is on Windows 10 only. ECHO You do not appear to be running Windows 10. ECHO This script will now close. ECHO. PAUSE EXIT REM Windows 10 detected so lets get started :Win10 IF EXIST %DisabledDir% ( :Enable REM Enable Cortana by removing the prefix 'DISABLED.' MOVE %DisabledDir% %EnabledDir% IF NOT ERRORLEVEL 1 (GOTO :EnableSuccess) ELSE (GOTO :EnableFail) :EnableSuccess CLS ECHO Cortana has been enabled. ECHO. ECHO Right-click an empty spot on the desktop taskbar ECHO and select Cortana - Show to show the Cortana search ECHO box or icon. ECHO. ECHO Sign out or restart Windows to start Cortana ECHO. PAUSE EXIT :EnableFail REM Forecolour Red COLOR 0C ECHO There was an error enabling Cortana. ECHO. ECHO Try running this script again or Delete the ECHO 'DISABLED.' prefix on the Cortana directory ECHO in %SYSTEMROOT%\SystemApps ECHO. PAUSE EXIT ) ELSE (GOTO :Disable) REM Lets try to disable Cortana :Disable IF EXIST %EnabledDir% ( REM Kill Cortana processes. TASKKILL /F /IM Search* TASKKILL /F /IM backgroundTaskHost* REM If disabling Cortana fails because of a file is being used by another process error REM Uncomment (delete REM) on the 5 lines below REM END so TASKKILL can have 2 more goes at killing the processes REM Increase the number of TASKKILL loops by changing the 2 in (1,1,2). REM Some people have reported that having Task Manager open helps TASKKILL kill the processes REM I cannot imagine why it would but we are dealing with Windows. REM END REM FOR /L %%A IN (1,1,2) DO ( REM TASKKILL /F /IM Search* REM TASKKILL /F /IM backgroundTaskHost* REM ECHO Stop processes attempt: %%A REM ) REM Uncomment (delete REM ) on the 2 lines below if you get ownership errors and try again. REM takeown /f %SYSTEMROOT%\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy /r /d y REM icacls %SYSTEMROOT%\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy /grant username_or_usergroup:F /t /q REM Disable Cortana by prefixing the Cortana directory with 'DISABLED.' MOVE %EnabledDir% %DisabledDir% IF NOT ERRORLEVEL 1 (GOTO :Success) ELSE (GOTO :Fail) REM Cortana has been disabled :Success CLS ECHO Cortana has been disabled ECHO. ECHO Right-click an empty spot on the desktop taskbar ECHO and select Cortana - Hidden to hide the Cortana ECHO search box ECHO. PAUSE EXIT REM Could not disable Cortana :Fail COLOR 0C ECHO. ECHO FAILURE ECHO. ECHO Could not disable Cortana. Make sure to run this script as an Administrator ECHO by right-clicking it and choosing 'Run as administrator'. ECHO. PAUSE EXIT ) ELSE (GOTO :NotFound) REM Cannot find the Cortana directory :NotFound ECHO Cortana directory not found. ECHO. ECHO The directory 'Microsoft.Windows.Cortana_cw5n1h2txyewy' ECHO should be in %SYSTEMROOT%\SystemApps ECHO. PAUSE EXIT