Modifying DWORD Registry Entries with AutoIt

I’ve just discovered something that may seem obvious, but considering I had a bit of a tough time finding the answer, I figured I’d post to potentially help someone else out that might be struggling with the same issue.

When modifying registry entries (potentially from a login script) using AutoIt Script, the RegWrite command needs numbers in the format 0×00000000 if you want it to write the number as hexidecimal.  It will not take just the number string like 00000000.  If you use the format 00000000, it will import the number as decimal, not hex.

For example, the following AutoIt script sets the current user Internet cache to 25 megabytes:

RegWrite ("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\Cache\Content", "CacheLimit", "REG_DWORD", "0x00006400")
RegWrite ("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Cache\Content", "CacheLimit", "REG_DWORD", "0x00006400")

I had mistakenly assumed that the REG_DWORD would import as Hex, which it does not.  It defaults to Binary.  Now that I think about it, this makes perfect sense because it is exactly as RegEdit itself would work.

2 Responses to “Modifying DWORD Registry Entries with AutoIt” »»

  1. Comment by Sanix | 04/17/09 at 9:05 pm

    tgeorge thanks alot for the help. Your finding actually helped me develop my virus removal tool.

    Keep up with AutoIt and I’ll always be a reader of your blog :-)

  2. CD
    Comment by CD | 03/04/10 at 1:42 pm

    Thanks for posting this. Helped me finish a script to change word and excel default save settings.

Leave a Reply »»