Launch a Powershell script

  1. 7 weeks ago

    Bill S

    Aug 31 Pre-Release Testers, Xojo Pro
    Edited 7 weeks ago

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

    How can I shell/run/launch it?

  2. Wayne G

    Sep 1 Pre-Release Testers, Xojo Pro New Zealand

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

  3. Tim J

    Sep 1 Pre-Release Testers, Xojo Pro Dehydrating in AZ

    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:

  4. 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.

or Sign Up to reply!