To start a PowerShell script in PowerShell from a shortcut, follow these steps:
- Create a new shortcut by right-clicking on the desktop and selecting “New” > “Shortcut.”
- In the “Create Shortcut” window, enter the following command in the “Type the location of the item” field:
powershell.exe -ExecutionPolicy Bypass -File "Path\to\Script.ps1"
Make sure to replace “Path\to\Script.ps1” with the actual path to your PowerShell script.
This command tells PowerShell to run the script with the execution policy set to Bypass, allowing the script to run without any restrictions.
- Click “Next” to continue.
- Give your shortcut a name and click “Finish” to create the shortcut.
You can now double-click the shortcut to start the PowerShell script.