- Article
Short description
Explains how to use the Run with PowerShell feature to run a script from afile system drive.
Long description
Beginning in Windows PowerShell 3.0, you can use the Run with PowerShellfeature to run scripts from File Explorer. The Run with PowerShell featureis intended to run scripts that don't have required parameters, don't returnoutput to console, and don't prompt for user input. When you use the Run withPowerShell feature, the PowerShell console window appears only briefly, if atall.
To use the Run with PowerShell feature:
In File Explorer (or Windows Explorer), right-click the script filename andthen select Run with PowerShell.
The Run with PowerShell feature starts a Windows PowerShell session that hasan execution policy of Bypass, runs the script, and closes the session.
It runs a command that has the following format:
pwsh.exe -File <FileName> -ExecutionPolicy Bypass
Run with PowerShell sets the Bypass execution policy only for the session(the current instance of the PowerShell process) in which the script runs.This feature doesn't change the execution policy for the computer or theuser.
The Run with PowerShell feature is affected only by the AllSigned executionpolicy. If the AllSigned execution policy is effective for the computer or theuser, Run with PowerShell runs only signed scripts. Run with PowerShellis not affected by any other execution policy. For more information, seeabout_Execution_Policies.
Note
Run with PowerShell feature might prompt you to confirm the executionpolicy change.