{"id":8561,"date":"2020-09-24T20:40:32","date_gmt":"2020-09-24T20:40:32","guid":{"rendered":"http:\/\/putridparrot.com\/blog\/?p=8561"},"modified":"2020-09-24T20:40:32","modified_gmt":"2020-09-24T20:40:32","slug":"powershell-from-file-explorers-context-menu","status":"publish","type":"post","link":"https:\/\/putridparrot.com\/blog\/powershell-from-file-explorers-context-menu\/","title":{"rendered":"Powershell from File Explorer&#8217;s context menu"},"content":{"rendered":"<p>Let&#8217;s add an &#8220;Open Poweshell&#8221; option to the File Explorer context menu.<\/p>\n<ul>\n<li>Run Regedit<\/li>\n<li>Go to HKEY_CLASSES_ROOT\\Directory\\shell<\/li>\n<li>Add a new key to this, we&#8217;ll call ours <em>power_shell<\/em> as you may already see a <em>PowerShell<\/em> option and I don&#8217;t want to change that one<\/li>\n<li>Change Default for the key to the text you want display in your context menu, i.e. <em>Open Powershell Here<\/em><\/li>\n<li>Add a new string value named <em>Icon<\/em> and in it&#8217;s value put C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe<\/li>\n<li>Add a new key to the <em>power_shell<\/em> key, named <em>command<\/em>. This is what&#8217;s actually run in the <em>Default<\/em> key put C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit -Command Set-Location -LiteralPath &#8216;%L&#8217;<\/li>\n<\/ul>\n<p>This will now show the <em>Open Powershell Here<\/em> option when you click on a folder in File Explorer, but what about if you&#8217;re already in the folder and want to open powershell from the current folder, then&#8230;<\/p>\n<ul>\n<li>If you&#8217;ve closed Regedit then run Regedit again<\/li>\n<li>Go to HKEY_CLASSES_ROOT\\Directory\\background\\shell<\/li>\n<li>Add a key named <em>power_shell<\/em> as before<\/li>\n<li>As before we now add a string value named <em>Icon<\/em> with the same value as above<\/li>\n<li>Again add a <em>command<\/em> subkey and with a slightly change add the following value into the <em>Default<\/em> key C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit -Command Set-Location -LiteralPath &#8216;%V&#8217; &#8211; note we change %L to %V<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Let&#8217;s add an &#8220;Open Poweshell&#8221; option to the File Explorer context menu. Run Regedit Go to HKEY_CLASSES_ROOT\\Directory\\shell Add a new key to this, we&#8217;ll call ours power_shell as you may already see a PowerShell option and I don&#8217;t want to change that one Change Default for the key to the text you want display in [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[118,53],"tags":[],"class_list":["post-8561","post","type-post","status-publish","format-standard","hentry","category-powershell","category-windows"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/8561","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/comments?post=8561"}],"version-history":[{"count":3,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/8561\/revisions"}],"predecessor-version":[{"id":8564,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/8561\/revisions\/8564"}],"wp:attachment":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/media?parent=8561"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/categories?post=8561"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/tags?post=8561"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}