The Colour settings are stored for each PuTTY session in the registry keys (each named after the session) under the key
HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions
I've seen other posts that suggest fixing the default colors by running a .reg file to create a new session with the desired colors but that doesn't help if you've got dozens of sessions that have the wrong (I mean default) color settings already.
Since Putty runs on Windows, the tool that made the most sense to help fix it is an add-on, techie utility from Microsoft called PowerShell. PowerShell makes it reasonably easy to perform useful "extra" stuff like listing and modifying specific registry keys. Without getting into a full PowerShell tutorial, which you can find at Microsoft's Technet Site if you like, I'll just skip to the how-to instructions. Before you do any of this, as everyone else always warns, this modifies the Windows registry, so you should make a backup, buy a spare computer, print out all your photos on archival paper, create a rescue disk, retain the services of at least two system recovery experts, etc. etc... So you've been warned, and it's 100% your responsibility if you screw something up, even if I made some mistake writing this.
- Download PowerShell (any version) from Microsoft's web site, and install it.
- Run PowerShell from a command prompt (assuming if you use PuTTY, you'd be comfortable with this).
- Enter the PowerShell cmdlet Set-ExecutionPolicy Unrestricted (so you can run your own unsigned scripts) See: http://technet.microsoft.com/en-us/library/ee176961.aspx
- Save the script code below into a file named "fix-putty-colors.ps1" (to most people, it should be reasonably obvious what the script does).
- Execute the script from within PowerShell
- Enter the PowerShell cmdlet Set-ExecutionPolicy Restricted (this is optional but for those who are in the paranoid-about-security camp, it makes it slightly harder for a rogue script to run accidentally after you've finished fixing the PuTTY registry settings).
Script Code (modify to set other color codes and/or add other color properties if desired):
Push-LocationSet-Location 'HKCU:\Software\SimonTatham\PuTTY\Sessions'
Get-ChildItem |
ForEach-Object {
Push-Location
Set-Location Registry::$_
Set-ItemProperty -Path . -Name Colour14 -Value '150,150,187'
Set-ItemProperty -Path . -Name Colour15 -Value '200,200,255'
Pop-Location
}
Pop-Location
No comments:
Post a Comment