Why regwrite doesn't work ?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
woshichuanqilz72
Posts: 117
Joined: 05 Oct 2015, 21:23

Why regwrite doesn't work ?

08 Nov 2017, 20:54

I want to use regwrite to set the internet confiuration

Code: Select all

RegWrite, REG_SZ, HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings, AutoConfigURL, xxxx
But it doesn't work.

And If I double click the reg file with this content it will work.

Why is that ? and how to make the regwrite work?

here is the reg file content if double click it it will ok.

Code: Select all

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]
"AutoConfigURL"="xxxx"
User avatar
Exaskryz
Posts: 2882
Joined: 17 Oct 2015, 20:28

Re: Why regwrite doesn't work ?

08 Nov 2017, 21:22

Apparently you need to run your AHK script as an administrator to write that Registry Key. I don't know why, but running as admin on your code worked. It did not work for me without launching my script as admin.

I did this and it worked without admin: ^7::RegWrite, REG_SZ, HKEY_CURRENT_USER\Software\Nexon, (Default), 5. So it seems particular directories or subkeys need admin permission to write to them.
woshichuanqilz72
Posts: 117
Joined: 05 Oct 2015, 21:23

Re: Why regwrite doesn't work ?

08 Nov 2017, 21:46

done I try this code and success.

Code: Select all

ctt := "Windows Registry Editor Version 5.00`n`n[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]`n""AutoConfigURL""=""xxxx"""

FileAppend, %ctt%, %filename%

Run, regedit.exe /s %filename%

Clipboard := filename
kadhri
Posts: 49
Joined: 12 Nov 2015, 06:52

Re: Why regwrite doesn't work ?

10 Nov 2017, 13:54

See A_isAdmin in help index
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Why regwrite doesn't work ?

10 Nov 2017, 14:33

I would create a small script like this:

Code: Select all

if !A_IsAdmin
	Run, % "*RunAs " (A_IsCompiled ? "" : A_AhkPath " ") Chr(34) A_ScriptFullPath Chr(34)
;use the RegWrite line at your own risk, I don't know what it changes
RegWrite, REG_SZ, HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings, AutoConfigURL, xxxx
Cheers.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot] and 95 guests