2

我需要向注册表写入一个新值。我遇到了以下代码,因为我可以添加的是标准键,我需要将新的十进制值放置到 DWORD 键(与十六进制值相匹配)

{Dim wsh wsh = CreateObject("WScript.shell") wsh.regwrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Explorer\NoDrives\dword", "789")}

4

1 回答 1

0

我会使用类似的东西:

Imports Microsoft.Win32

Sub SetNoDrives(value As Integer)
    Dim RegPath As String = "SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Explorer"
    Using Key As RegistryKey = Registry.LocalMachine.OpenSubKey(RegPath)
        Key.SetValue("NoDrives", value, RegistryValueKind.DWord)
    End Using
End Sub
于 2011-06-30T07:37:53.590 回答