/writereg

By zonirc on Aug 08, 2005

this is a simple snippet which allow to write into registry without using a dll
but its will using Windows Scripting(which this snippet will write the relevant
script for you and run it to accomplish the task to writing to registry.

/*
Mon Aug 08 2005 - 04:00:44 
Name: /writereg
Author:zonIRC
Email:zonirc@email.com
Description:this is a simple snippet which allow to write into registry without using a dll 
but its will using Windows Scripting(which this snippet will write the relevant
script for you and run it to accomplish the task to writing to registry.
Syntax:
/writereg <key>, <value>[, REG_DWORD|REG_BINARY]
<key> is the section that you see in a left panel of registry editor.
However, you cant create a top level key... and also you need to know the acronoym
of top level key to accomplish it.
HKCR = HKEY_CLASSES_ROOT
HKCU = HKEY_CURRENT_USER
HKLM = HKEY_LOCAL_MACHINE
the other 3 seems cant write into it....
<value> is the value of the key.
[, REG_DWORD|REG_BINARY] is optional which is you can specify it or not.
When specified only 2 value are accepted, either REG_DWORD or REG_BINARY
Examples:
/writereg HKLM\, writereg data
- will write into HKEY_LOCAL_MACHINE default value as "writereg data"
/writereg HKLM\MYDATA, writereg data
- will write into HKEY_LOCAL_MACHINE MYDATA value as "writereg data"
/writereg HKLM\MYDATA\, writereg data
-will write into HKEY_LOCAL_MACHINE\MYDATA\ default value as "writereg data"
Info: 
The script for Windows Scripting is a Copyright (C) 1996-1997 Microsoft Corporation
which is I'm had modified its to only had a few line :p
If you wonder where to get the sample of it, you can view it on your computer
which by default it will reside on C:\windows\sample\
theres a several sample script of vbs and js.
The original sample had shown how to delete the data in registry also.
*/
Description
alias writereg {
  if ($numtok($1-,44) isnum 2-3) {
    tokenize 44 $1-
    var %key = $upper($+(",$remove($1,"),")) $+ $chr(44) $iif($2 isnum,$remove($2,"),$+(",$2,")) $iif($istok(REG_DWORD REG_BINARY,$3,32),$chr(44) $upper($3))
    write temp.vbs Dim WSHShell $crlf $+ Set WSHShell = WScript.CreateObject("WScript.Shell") $+ $crlf WSHShell.RegWrite %key
    run temp.vbs
    remove temp.vbs
  }
  else {
    echo $color(info) -s * /writereg: Invalid Parameter.
  }
}

Comments

Sign in to comment.
zonirc   -  Aug 09, 2005

right QuickStep its need Scripting Object being installed on the PC, and also if its installed your anti virus need to configured to accept .vbs coz some anti virus had blocked .vbs options. Sorry for not informing about this...(well actually im just know about it today hehhehehehehhe)

 Respond  
QuickStep   -  Aug 09, 2005

i think you need visual basic installed to run vbs files, anyone can confirm this?

 Respond  
mfk   -  Aug 08, 2005

nice, gg

 Respond  
DarthReven   -  Aug 08, 2005

this is a nice alias but i wouldn\'t suggest using it if you don\'t know what your doing. your windows registry is very delecate and one mistake in it can cause serious problems

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.