views:

1104

answers:

1

Which of the following registry scripts is syntactically correct? Will both work? Is one preferred?

Sample A:

REGEDIT4

[HKEY_LOCAL_MACHINE\software\microsoft\windows\currentversion\policies\explorer]
"nodrivetypeautorun"=255

Sample B:

REGEDIT4

[HKEY_LOCAL_MACHINE\software\microsoft\windows\currentversion\policies\explorer]
"nodrivetypeautorun"=dword:000000FF

Technically, in this example, the "nodrivetypeautorun" element is a dword data type. I don't want to fixate on the "nodrivetypeautorun" element. I am only concerned about dword data types and the proper way to set them in a registry script.

I think that Sample A will fail to import the value, and I think I can prove it. What I need is a reference online that will back me up because some people that I work with won't take my word for it, even if I demonstrate the problem. I've spent some time with google and can't find what I'm looking for. The preferred answer to this question should have such a reference, but I'd settle for a general consensus from other professionals.

A: 

The MS Knowledgebase has an article on this.

http://support.microsoft.com/kb/310516/

Here's the excerpt you'd be interested in:

Syntax of .Reg Files A .reg file has the following syntax:

RegistryEditorVersion Blank line [RegistryPath1] "DataItemName1"="DataType1:DataValue1" DataItemName2"="DataType2:DataValue2" Blank line [RegistryPath2] "DataItemName3"="DataType3:DataValue3"

So it would seem the 'official' way to set a value includes specifying the 'DataType', in your case 'dword'.

atom255