I'm attached to the nice blue colour of the PowerShell window when you launch it from one of the pre-installed shortcuts. However, if you manually launch powershell.exe, you don't get these colours, you get black/white :(
This is because the default settings are set on the shortcut (.lnk) file:
I've got a "PowerShell Prompt Here" entry in Explorer context menu, and I'd like it to launch PowerShell using the same nice colours as the usual shortcut; black sucks, and it's confusing to have different coloured windows (especially when I have some old-school command windows open frequently that are also black!).
I've found two problems with trying to set this so far:
- Setting the colour from within PowerShell seems to only allow certain values (ConsoleColor enum), none of which match the one on the default shortcut.
- Setting the colour within the PS Profile causes only text written afterwards to honour the new background colour. Adding "cls" causes a nasty flash of the original colour as it starts.
Is there any way to launch PowerShell from a command line (ie. that I can embed in the registry as an Explorer context menu item) that will use the same settings as the shortcut?
I found it very useful to use concfg tool and scoop to install colors and fonts for Powershell:
Install scoop:
Install concfg:
Install Solarized theme:
That's it, thanks to the authors!
Edit your profile script (pointed to by $profile) and set the desired colors yourself:
This was my solution (setting the colors in a script that launches as system). May be more than you need (see my own answer):
https://superuser.com/questions/891519/using-psexec-to-launch-powershell-session-as-system-with-specific-window-attribu
regedit
command to open registry editorHKEY_CURRENT_USER > CONSOLE
and Backup entire folder by exporting just in caseRestart your Powershell, the color scheme must have reset to defaults.
Note: If you have any other settings related to PowerShell (or Command Prompt, Git Bash etc) which you might want to keep, please further explore Console Folder to delete appropriate keys
Click the system menu (PowerShell icon in the top-left of the window) and click Defaults. You can change the default colors here and it will be respected by the PowerShell Prompt Here command.
From: https://superuser.com/a/523017/109736
The correct way to do this is with the Registry