这个问题其实有人反馈给微软,但是微软工程师需要更多的出问题的实例来解决这个问题。可惜我已经按照官方给的方法解决了。其中比较麻烦时PowerShell可执行策略的修改,要保证无签名的Powershell脚本能够执行。
我系统是1909 ,微软官方文档说适用于1903及后续系统,1809以及之前的版本是通过重置Cortana来重置搜索的,微软官方提供的方法链接我先挂在上面
- https://support.microsoft.com/en-us/help/4520146/fix-problems-in-windows-search
复制代码 我用的有用的方法直接贴在下面,这样方便有问题的朋友去微软文档找到对应的部分
Windows 10, version 1903 and later
If the Windows 10 May 2019 Update or a later update is installed, use Windows PowerShell to reset Windows Search. To do this, follow these steps.
Note You must have administrator permissions to run this script.
Download the "ResetWindowsSearchBox.ps1" script from the Microsoft Download Center, and save the file to a local folder:
Reset Windows Search PowerShell script
Right-click the file that you saved, and select Run with PowerShell.
If you are asked "Do you want to allow this app to make changes to your device?," select Yes.
The PowerShell script resets the Windows Search feature. When the word "Done" appears, close the PowerShell window.
If you receive a "Cannot be loaded because running scripts is disabled on this system" error message, enter the following command on the command line of the PowerShell window, and then press Enter:
Get-ExecutionPolicy
Note The current policy appears in the window. For example, you might see Restricted. We recommend that you note this value because you'll have to use it later.
Enter the following command on the command line of the PowerShell window, and then press Enter:
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted
Note You'll receive a warning message that explains the security risks of an execution policy change. Press Y, and then press Enter to accept the change.
To learn more about PowerShell execution policies, see About Execution Policies.
After the policy change is completed, close the window, and then repeat steps 2–4. However, when the "Done" message appears this time, DON'T close the PowerShell window. Instead, press any key to continue.
Revert to your previous PowerShell execution policy setting. To do this, enter the following command on the command line of the PowerShell window, press the Spacebar, enter the policy value that you noted in step 5, and then press Enter:
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy
For example, if the policy that you noted in step 5 was Restricted, the command would resemble the following:
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Restricted
Note You'll receive a warning message that explains the security risks of an execution policy change. Press Y, and then press Enter to accept the change and revert to your previous policy setting.
Close the PowerShell window.
其中的问题在于ExecutionPolicy ,不过我要运行自己写的PS脚本所有我的ExecutionPolicy是更改过的,我的建议是更改前先用powershell查看你所有条件下对应的ExecutionPolicy
这个命令是:- Get-ExecutionPolicy -List
复制代码 我的电脑会得出如下结果: Scope ExecutionPolicy
----- ---------------
MachinePolicy Undefined
UserPolicy Undefined
Process Undefined
CurrentUser Undefined
LocalMachine RemoteSigned 微软官方文档修改策略的Scope是CurrentUser,事实上在我的电脑运行脚本是需要管理员权限,我自己修改的Scope是LocalMachine,将其修改成Unrestricted,命令如下:- Set-ExecutionPolicy -Scope LocalMachine -ExecutionPolicy Unrestricted
复制代码 然后在管理员权限的下执行PS脚本- .\ResetWindowsSearchBox.ps1
复制代码 会显示如下界面:
安全警告
请只运行你信任的脚本。虽然来自 Internet 的脚本会有一定的用处,但此脚本可能会损坏你的计算机。如果你信任此脚本,请使用
Unblock-File cmdlet 允许运行该脚本,而不显示此警告消息。是否要运行 C:\Users\DongX\Downloads\ResetWindowsSearchBox.ps1?
[D] 不运行(D) [R] 运行一次(R) [S] 暂停(S) [?] 帮助 (默认值为“D”): r
Verifying that the script is running elevated
Resetting Windows Search Box
Done...
Press any key to continue... 然后关掉所有的资源管理器窗口,重新打开就好了,脚本也可以在我上面给的连接中下载。
另外我为什么用微软自带的搜索而不是用Everything等第三方,是因为我微软搜索建立的索引能够快速搜索所有文档的内容,这个功能是我想要的。因为我的文档太多了,就算我已经尽自己所能对文档加了各种标签和关键词,但有时候只记得内容的时微软搜索框能够快速搜索文件内容时真的棒,而且这功能不需要联网,断网也可以用。当然你需要打开Windows索引服务就是了。
下微软快速搜索文档内容的实例:搜索smartAudio 是这个机器自带的功能
|