Jump to content

RegWrite


pikaeh
 Share

Recommended Posts

;RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\", "NoDrives", "REG_DWORD", "3")

$r = '"HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoDrives", "REG_DWORD", "3"'

or

$r = '"HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer"' & ', ' & '"NoDrives"' & ', ' & '"REG_DWORD"' & ', ' & '"3"'

MsgBox(0, "$r", $r)

RegWrite($r)

I'm trying to read the $r value from an ini file and run it with RegWrite($r) but that doesn't work. What am I doing wrong?

Link to comment
Share on other sites

You cannot put multiple parameters into a single string. You can use stringsplit if you have to put the parameters together, but it would be best to just use separate variables for each parameter.

$a = "HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer"
$b = "NoDrives"
$c = "REG_DWORD"
$d = "3"

RegWrite($a, $b, $c, $d)

or you could use stringsplit:

$r = "HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer,NoDrives,REG_DWORD,3"
$Split = StringSplit($r, ",")

RegWrite($Split[1], $Split[2], $Split[3], $Split[4])
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...