Showing posts with label Windows. Show all posts
Showing posts with label Windows. Show all posts

Sunday, 4 January 2009

How to change the Blue Screen of Death into another colour

We have all had a BSOD (Blue Screen Of Death) when something catastrophic has happened with Windows - which is usually when you try to do anything useful, but if you get tired of it being the standard Blue or if you have a visual imparement so the default settings are useless for you, here’s how to change it.


First open the SYSTEM.INI file found in the %systemroot% folder (usually C:\Windows) and locate the [386enh] section.


Add the following two entries if they are not present:


MessageBackColor=

MessageTextColor=


Each of those entries take a single hexadecimal digit defining the colour:

  • 0 - Black
  • 1 - Blue
  • 2 - Green
  • 3 - Cyan
  • 4 - Red
  • 5 - Magenta
  • 6 - Yellow
  • 7 - White
  • 8 - Grey
  • 9 - Bright blue
  • A - Bright green
  • B - Bright cyan
  • C - Bright red
  • D - Bright magenta
  • E - Bright yellow
  • F - Bright white


So to change it to Cyan and bright white text, then use the following:


MessageBackColor=3

MessageTextColor=F


The settings will take effect the next time you restart Windows.


NB: The values must be in upper case hence using F and not f in the above example.

Monday, 29 December 2008

Finding the process id of the process owning a port

Occasionally there’s time where you need to find out what process owns a port currently open.


On the Mac this can be done easily by using the following line - here we are looking for port 8080:


ps u --no-heading -p  `netstat -nlept | awk '/[:]8080 / {split ($9,t,"/"); print t[1]}'` 2>/dev/null


For windows you don’t have a decent shell (and cygwin would probably not work here), so you can use the following batch script to do the same:


@echo off


for /F “usebackq tokens=5″ %%f in (`netstat -b -n ^| find “:%1″`) do call :process %%f

goto :eof


:process

tasklist /FI “PID eq %1″ /NH


If the above code was called findport.bat then running findport 8080 would then find the process owning port 8080.