I'm looking for a way to create a shortcut on my desktop that executes a PowerShell command to open Night Light settings directly, instead of having to copy and paste it every time. I've seen the command work in PowerShell, but I'm not sure how to make it a clickable shortcut. Is there a tool or method that can help me achieve this?
4 Answers
You might not even need PowerShell for this! Just create a new shortcut on your desktop and set the target to `ms-settings:nightlight`. This will directly open the Night Light settings without any extra clicks. Skip using 'start' in the shortcut target, and it should work perfectly!
Yeah, I think you're right! That simplifies things a lot.
I've had success with a tool called ps2exe. It can convert your scripts into executables quite effectively and comes with a lot of customization options if needed.
PowerShell scripts usually don't run as standalone executables due to security settings. Instead, you could create a `.bat` file that launches PowerShell with your command. Just make sure to use the correct paths when you're implementing it.
If you want to stick with PowerShell, you can make a shortcut by right-clicking on your desktop, then choosing 'New > Shortcut'. Depending on your PowerShell version, you can use:
- For PowerShell 5.1: `powershell.exe -ExecutionPolicy Bypass -Command Start-Process ms-settings:nightlight`
- For PowerShell 7: `pwsh.exe -ExecutionPolicy Bypass -Command Start-Process ms-settings:nightlight`
I tried this out, and it worked flawlessly! Definitely the easiest solution.