Windows Registry tool

The code:

require ‘win32ole’;class P;def initialize;@s=WIN32OLE.new
“WScript.Shell”;
@p="";end;def p p;@p=p;end;def sk k,v;@s.RegWrite “#{@p}\#{k}”, v;end;
def gk(k);@s.RegRead “#{@p}\#{k}”;end;def i(file);regedit /s #{file};
end;end;puts P.new.instance_eval(ARGF.read)

Usage:

point at a script or input from stdin

do something like this:

p ‘HKEY_LOCAL_MACHINE\Software\gaim’
sk ‘apple’, ‘banana’

or

i ‘something.reg’
p ‘A\path\that\should\have\changed’
gk ‘this_key_should_be_different’

Full list of commands:

p - sets the ‘path’
i - imports a registry file
sk - sets a key to the specified value
gk - gets the value of the given key

This program will print out the value of the evaluated code. (i.e.
the last line executed)

Sorry for the golfing and the ugly interface. I was just playing
around and came up with this, and though maybe someone might find it
useful?