Windows Registry tool.

Discussion in 'Ruby' started by Gregory Brown, Mar 31, 2006.

  1. The code:

    require 'win32ole';class P;def initialize;@s=3DWIN32OLE.new "WScript.Shell"=
    ;
    @p=3D"";end;def p p;@p=3Dp;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?
     
    Gregory Brown, Mar 31, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. HK
    Replies:
    1
    Views:
    3,692
    Cowboy \(Gregory A. Beamer\)
    Apr 1, 2004
  2. Replies:
    0
    Views:
    770
  3. Leny
    Replies:
    3
    Views:
    16,974
    Daniel
    Feb 1, 2005
  4. Rob Schieber

    Web Service Registry tool

    Rob Schieber, Oct 14, 2005, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    105
    Rob Schieber
    Oct 14, 2005
  5. Collin Miller
    Replies:
    10
    Views:
    652
    Roger Pack
    Jul 9, 2010
Loading...

Share This Page