Launch a Powershell script

My program builds a powershell script and saves it to the temp folder as ‘MyScript.ps1’.

How can I shell/run/launch it?

Create a Shell and execute the command “Powershell.exe -File %temp%\myscript.ps1”

Note that you may need to provide the full path to the PowerShell.exe app depending on your Windows setup. On my systems that maps to:

C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe

One of many PowerShell security features is that you can’t run a script simply by double clicking it’s icon on desktop or in a folder.
1.) Right click a script, select Create shortcut
2.) Right click the shortcut, select Properties
3.) The Target field under Shortcut tab shows full path to file this shortcut will open
5.) At the moment shortcut would act exactly as the script icon, open script in Notepad for editing.
\then save it by OK nd execute the command “Powershell.exe -File %temp%\myscript.ps1”
its simple.