如何使用PowerShell设置锁屏壁纸?切换Windows Spotlight至照片模式并指定图片时遇路径不存在报错的技术咨询
Hey there, let's work through this issue step by step. The error you're hitting is totally expected—because the registry path you're trying to target doesn't exist by default. Let's cover both of your required tasks: switching from Windows Spotlight to Photo mode, and getting that PowerShell command to work properly.
Task 1: Switch Lock Screen to Photo Mode
- Hit Win + I to open Settings
- Navigate to Personalization > Lock screen
- Under the "Personalize your lock screen" dropdown, select Photos (replacing Windows Spotlight)
Task 2: Fix the PowerShell Registry Path Error & Set Your Custom Image
The HKLM:\SOFTWARE\Policies\Microsoft\Windows\Personalization key isn't created automatically—we have to make it first. Here's the full workflow:
- Launch PowerShell as Administrator (right-click the Start menu, choose "Windows PowerShell (Admin)")
- Create the missing registry path with this command:
New-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows' -Name Personalization -Force - Now run your original command (just double-check your image path is correct—if
C:\Custom-Folder\wallpaper.jpgdoesn't exist, you'll get a different error!):Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Personalization' -Name LockScreenImage -Value "C:\Custom-Folder\wallpaper.jpg" - To see the change right away, you can restart File Explorer (no need to log out):
Stop-Process -Name explorer -Force Start-Process explorer
Quick Notes
- Using this Group Policy-backed registry key will override any lock screen image set via the Settings app. If you want to go back to using Settings later, just delete the key with:
Remove-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Personalization' -Recurse -Force - Always verify your image file path—typos or missing folders/files are a common gotcha here.
内容的提问来源于stack exchange,提问作者Kennycampbell1
相关产品推荐
相关产品推荐

