{"id":12967,"date":"2018-09-30T03:03:48","date_gmt":"2018-09-30T03:03:48","guid":{"rendered":"https:\/\/www.top-password.com\/blog\/?p=12967"},"modified":"2018-09-30T03:03:48","modified_gmt":"2018-09-30T03:03:48","slug":"set-ps1-script-to-open-with-powershell-by-default","status":"publish","type":"post","link":"https:\/\/www.top-password.com\/blog\/set-ps1-script-to-open-with-powershell-by-default\/","title":{"rendered":"How to Set .PS1 Script to Open with PowerShell By Default"},"content":{"rendered":"<p>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.<\/p>\n<p><strong>Method 1: Associate .PS1 to Open in PowerShell <\/strong><\/p>\n<ol>\n<li>Right-click any .ps1 file in File Explorer, and then select <strong>Open with<\/strong> from the context menu.\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.top-password.com\/blog\/wp-content\/uploads\/2018\/09\/open-with-context-menu.png\" alt=\"\" width=\"364\" height=\"426\" class=\"alignnone size-full wp-image-12975\" \/>\n<\/li>\n<li>If the PowerShell program isn&#8217;t listed, click on <strong>More apps<\/strong>.\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.top-password.com\/blog\/wp-content\/uploads\/2018\/09\/how-to-open-this-file.png\" alt=\"\" width=\"392\" height=\"404\" class=\"alignnone size-full wp-image-12973\" \/>\n<\/li>\n<li>Check the box labeled &#8220;<strong>Always use this app to open .ps1 files<\/strong>&#8220;, and click on &#8220;<strong>Look for another app on this PC<\/strong>&#8220;.\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.top-password.com\/blog\/wp-content\/uploads\/2018\/09\/use-this-app-to-open-ps1.png\" alt=\"\" width=\"392\" height=\"477\" class=\"alignnone size-full wp-image-12974\" \/>\n<\/li>\n<li>When the Open with dialog box appears, drill down to the directory <em>C:\\Windows\\System32\\WindowsPowerShell\\v1.0<\/em> and select the <em>powershell.exe<\/em> file. Click <strong>Open<\/strong>.\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.top-password.com\/blog\/wp-content\/uploads\/2018\/09\/open-with-dialog.png\" alt=\"\" width=\"600\" height=\"375\" class=\"alignnone size-full wp-image-12976\" \/>\n<\/li>\n<li>Now you&#8217;ve successfully set PowerShell as the default program for opening .ps1 file type.<\/li>\n<\/ol>\n<p><strong>Method 2: Change Default Program for Opening PowerShell Script<\/strong><\/p>\n<p>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.<\/p>\n<ol>\n<li>Open the Registry Editor. Copy the following line and paste it into the address bar, then press Enter.\n<p><code>HKEY_CLASSES_ROOT\\Microsoft.PowerShellScript.1\\Shell\\Open\\Command<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.top-password.com\/blog\/wp-content\/uploads\/2018\/09\/powershell-open-with-command.png\" alt=\"\" width=\"590\" height=\"258\" class=\"alignnone size-full wp-image-12977\" \/><\/p>\n<p>Next, double-click the <strong>(Default)<\/strong> value in the right pane.\n<\/li>\n<li>In the Edit String window, copy and paste the following command into the <strong>Value data<\/strong> field. Click <strong>OK<\/strong>.\n<p><code>\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" \"%1\"<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.top-password.com\/blog\/wp-content\/uploads\/2018\/09\/open-with-powershell-registry.png\" alt=\"\" width=\"382\" height=\"170\" class=\"alignnone size-full wp-image-12978\" \/>\n<\/li>\n<li>Close Registry Editor. From now on, any file type of PowerShell script will be opened in PowerShell instead of the Notepad program.<\/li>\n<\/ol>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>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 Right-click any .ps1 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,10,1894],"tags":[3990,3991,3993,3992],"class_list":["post-12967","post","type-post","status-publish","format-standard","hentry","category-others","category-tips-tricks","category-windows-10","tag-associate-ps1-to-powershell","tag-open-ps1-with-powershell","tag-powershell-set-default-programs-windows-10","tag-set-file-associations-in-powershell"],"_links":{"self":[{"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/posts\/12967","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/comments?post=12967"}],"version-history":[{"count":6,"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/posts\/12967\/revisions"}],"predecessor-version":[{"id":12980,"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/posts\/12967\/revisions\/12980"}],"wp:attachment":[{"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/media?parent=12967"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/categories?post=12967"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/tags?post=12967"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}