我一直在尝试制作一个批处理文件来禁用或启用Windows 10中的cortana。我做1,cortana进程只是暂停,没有关闭,因此它不重命名文件。我做错了什么?我已经要求管理员权限,有人可以帮忙吗?
PS - 我试过taskkill /g /im SearchUI.exe
,但同样的结果再现了。
@echo off
color 2
:: BatchGotAdmin
:-------------------------------------
REM --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
set params = %*:"=""
echo UAC.ShellExecute "cmd.exe", "/c %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
del "%temp%\getadmin.vbs"
exit /B
:gotAdmin
pushd "%CD%"
CD /D "%~dp0"
:--------------------------------------
echo 1. Disable Cortana
echo 2. Enable Cortana
echo .
CHOICE /C 12 /M "Which one would you like to do?"
If ErrorLevel 2 GOTO EnableCortana
If ErrorLevel 1 GOTO DisableCortana
:EnableCortana
Echo "Enabling Cortana..." (
ren C:\Windows\SystemApps\Microsoft.Windows.CortanaDISABLED_cw5n1h2txyewy Microsoft.Windows.Cortana_cw5n1h2txyewy
)
GOTO End
:Disable Cortana
Echo "Disabling Cortana..." (
taskkill /im SearchUI.exe
ren C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy Microsoft.Windows.CortanaDISABLED_cw5n1h2txyewy
)
GOTO End