Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - add value

Reply
 
Old 07-30-2008   #1 (permalink)
PaulM


 
 

add value

I am trying to add a value with a binary of 00,00,00,00 to the
Explorer key, but all this does is add a key under the explorer key.
WshShell.Run ("reg add
HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\link=hex:00,00,00,00")

I would to add the value "link" to the explorer key with a binary of 00 00
00 00.
You can not do it with a vbscript because it will only write 4 bytes, that's
00 00 not 8 0s.
Need help.


My System SpecsSystem Spec
Old 07-30-2008   #2 (permalink)
mayayana


 
 

Re: add value

Dim SH
Set SH = CreateObject("WScript.Shell")
SH.RegWrite "HKLM\Software\test1", CLng(0), "REG_BINARY"
Set SH = Nothing

Quote:

> I am trying to add a value with a binary of 00,00,00,00 to the
> Explorer key, but all this does is add a key under the explorer key.
> WshShell.Run ("reg add
>
HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\link=hex:00,00,00,00
")
Quote:

>
> I would to add the value "link" to the explorer key with a binary of 00 00
> 00 00.
> You can not do it with a vbscript because it will only write 4 bytes,
that's
Quote:

> 00 00 not 8 0s.
Each byte is 2 of the zeros, so 8 zeros IS 4 bytes.
Bytes are typically shown as 2-character hexadecimal
values that reprersent a number between 0 and 255:
00 A1 00 D0 FF

I doubt it all makes much difference, anyway. 4-byte
binary values are usually long integers, the same as
dword values. While binary is often used to "hide" text
strings or record long numeric lists, I don't remember
ever seeing a 4-byte binary value that was anything
more than a numeric value stored in a poorly-chosen
way. If you really want to store a numeric value it
would be easier to just store it as a dword value.



My System SpecsSystem Spec
Old 07-30-2008   #3 (permalink)
PaulM


 
 

Re: add value

That's was easy!! Thanks it works great. Every where I look all I could
fine was that a vbscript could on write 4 bytes to a reg_binary.


"mayayana" <mayaXXyana@xxxxxx> wrote in message
news:#3VmWmn8IHA.2060@xxxxxx
Quote:

> Dim SH
> Set SH = CreateObject("WScript.Shell")
> SH.RegWrite "HKLM\Software\test1", CLng(0), "REG_BINARY"
> Set SH = Nothing
>
>
Quote:

>> I am trying to add a value with a binary of 00,00,00,00 to the
>> Explorer key, but all this does is add a key under the explorer key.
>> WshShell.Run ("reg add
>>
> HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\link=hex:00,00,00,00
> ")
Quote:

>>
>> I would to add the value "link" to the explorer key with a binary of 00
>> 00
>> 00 00.
>> You can not do it with a vbscript because it will only write 4 bytes,
> that's
Quote:

>> 00 00 not 8 0s.
>
> Each byte is 2 of the zeros, so 8 zeros IS 4 bytes.
> Bytes are typically shown as 2-character hexadecimal
> values that reprersent a number between 0 and 255:
> 00 A1 00 D0 FF
>
> I doubt it all makes much difference, anyway. 4-byte
> binary values are usually long integers, the same as
> dword values. While binary is often used to "hide" text
> strings or record long numeric lists, I don't remember
> ever seeing a 4-byte binary value that was anything
> more than a numeric value stored in a poorly-chosen
> way. If you really want to store a numeric value it
> would be easier to just store it as a dword value.
>
>
>
My System SpecsSystem Spec
Old 07-30-2008   #4 (permalink)
mayayana


 
 

Re: add value

Quote:

> That's was easy!! Thanks it works great. Every where I look all I could
> fine was that a vbscript could on write 4 bytes to a reg_binary.
>
That is true. The 00 00 00 00 is 4 bytes. The 00 00 is
actually 2 bytes. For some reason VBS defaults to writing
a short integer value (2 bytes) unless you force it to be
a long integer with CLng. If you want to write anything
more than that you can use the SetBinaryValue method
of StdRegProv. (Requires that WMI be installed and running.)
You can also try to construct a .reg file and merge it,
but that's a bit awkward.



My System SpecsSystem Spec
Old 07-30-2008   #5 (permalink)
PaulM


 
 

Re: add value

Ok, Thanks for the info.


"mayayana" <mayaXXyana@xxxxxx> wrote in message
news:#JXjq8o8IHA.1196@xxxxxx
Quote:

>
Quote:

>> That's was easy!! Thanks it works great. Every where I look all I could
>> fine was that a vbscript could on write 4 bytes to a reg_binary.
>>
>
> That is true. The 00 00 00 00 is 4 bytes. The 00 00 is
> actually 2 bytes. For some reason VBS defaults to writing
> a short integer value (2 bytes) unless you force it to be
> a long integer with CLng. If you want to write anything
> more than that you can use the SetBinaryValue method
> of StdRegProv. (Requires that WMI be installed and running.)
> You can also try to construct a .reg file and merge it,
> but that's a bit awkward.
>
>
>
My System SpecsSystem Spec
Reply

Thread Tools



Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46