Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Here's a really easy way:</p> <h1>1. Add .LNK to your PATHEXT variable.</h1> <p>Start -> run "sysdm.cpl" -> advanced -> Environment Variables</p> <p>Scroll Down through system variables, double click PATHEXT</p> <p>Add .LNK; as depicted below:</p> <p><img src="https://i.stack.imgur.com/tEY0s.png" alt="Path Extension"></p> <h1>2 Copy the default "Windows Powershell.lnk"</h1> <pre><code>Copy-Item "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\Windows PowerShell\Windows PowerShell.lnk" "C:\Windows\System32\powershell.lnk" </code></pre> <h1>3. Typing "powershell" from a run prompt will now bring up the default console color/configuration.</h1> <p>You can further customize the .lnk in C:\Windows\System32 to your liking.</p> <p>Please note that this will only work because you have added the .lnk to the list of acceptable extensions AND c:\windows\system32 is the first item in the search path (PATH system variable) by default. </p> <p><strong><em>This will not customize the console if it is launched via cmd.exe.</em></strong></p> <h1>4. To make this work from the "Run Powershell Here" context menu, save this as a .reg file and import it:</h1> <pre><code>Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\PowerShellHere\command] @="C:\\WINDOWS\\system32\\cmd.exe /c start powershell -NoExit \"cd '%1';(get-host).ui.rawui.windowtitle = 'Oompa Loompa'\"" [HKEY_CLASSES_ROOT\Directory\shell\PowerShellHere\command] @="C:\\WINDOWS\\system32\\cmd.exe /c start powershell -NoExit \"cd '%1';(get-host).ui.rawui.windowtitle = 'Oompa Loompa'\"" </code></pre> <p>I am using cmd.exe to call "start" which will launch the powershell.lnk and pass the current working directory as an argument. Doesn't seem to work from the address bar yet. I should have gone home 45mins ago, but your problem was fun to solve! :) </p> <p>Bonus Points: You can thread the commands sent to Powershell. So, if you are looking to modify the Powershell console's title attribute:</p> <pre><code>\"cd '%1';(get-host).ui.rawui.windowtitle = 'Oompa Loompa'" </code></pre> <p>Simply add a semicolon between commands. </p> <p>Happy shelling</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload