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.
}
}