How can I turn my PowerShell script into a desktop shortcut?

0
5
Asked By CoolShade99 On

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

Answered By SunsetSeeker42 On

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!

MorningBrew55 -

I tried this out, and it worked flawlessly! Definitely the easiest solution.

CodeWizard88 -

Yeah, I think you're right! That simplifies things a lot.

Answered By ScriptMaster42 On

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.

Answered By TechieGuru27 On

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.

Answered By ExecPower88 On

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`

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.