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 0x00000000 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” »»