How to Set .PS1 Script to Open with PowerShell By Default

September 30, 2018 updated by Admin Leave a reply »

When you double-click a .ps1 file from File Explorer, Windows 10 will open it in Notepad rather than executing the script with PowerShell. If you want to set .ps1 script to open with PowerShell by default, you have to change the file type association.

Method 1: Associate .PS1 to Open in PowerShell

  1. Right-click any .ps1 file in File Explorer, and then select Open with from the context menu.

  2. If the PowerShell program isn’t listed, click on More apps.

  3. Check the box labeled “Always use this app to open .ps1 files“, and click on “Look for another app on this PC“.

  4. When the Open with dialog box appears, drill down to the directory C:\Windows\System32\WindowsPowerShell\v1.0 and select the powershell.exe file. Click Open.

  5. Now you’ve successfully set PowerShell as the default program for opening .ps1 file type.

Method 2: Change Default Program for Opening PowerShell Script

Need to associate all types of PowerShell script (.ps1, .psm1, .psd1, etc.) to open with PowerShell by default? You can do it with a simple registry tweak.

  1. Open the Registry Editor. Copy the following line and paste it into the address bar, then press Enter.


    Next, double-click the (Default) value in the right pane.

  2. In the Edit String window, copy and paste the following command into the Value data field. Click OK.

    "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" "%1"

  3. Close Registry Editor. From now on, any file type of PowerShell script will be opened in PowerShell instead of the Notepad program.