-1

for some reason i have to go into my registry editor every time i open my computer and change the value from 1 to 0 if i want to use any applications or games, it is becoming a bit tedious and i was wondering if anyone here could help me create a script of some kind that does it for me? I am not the best at coding and I have never written any kind of script before so i am just looking for a hand.

enter image description here

Hackoo
  • 18,337
  • 3
  • 40
  • 70
  • Yes, we could help you. Not do the job for you. – LS_ᴅᴇᴠ Oct 17 '17 at 08:30
  • i didn't ask you to do the job for me, i asked for your help, so thanks – River Johnstone Oct 17 '17 at 08:34
  • 1
    So, what have you done for us to help you? – LS_ᴅᴇᴠ Oct 17 '17 at 08:35
  • Rather than write a script (in fact it's just a one-liner, using the REG command, so you don't even need a script) you should instead look at what keeps resetting the value back to 1, and get rid of that unwanted effect. – DodgyCodeException Oct 17 '17 at 10:01
  • https://answers.microsoft.com/en-us/ie/forum/ie11-iewindows8_1/lan-connection-settings-keep-changing-back-to/76a0f5d2-167f-41fa-bf40-1461b8c01642 – DodgyCodeException Oct 17 '17 at 15:29
  • I mean, if someone keeps stealing your pen every day, you wouldn't set up a standing order with Amazon to ship you a new pen every day, would you? No, you would find out who keeps stealing your pen, and make them stop. Do the same with this registry setting instead of trying to code a workaround. – DodgyCodeException Oct 17 '17 at 15:32
  • okay, so how would i figure out where to go to find out what sets the value? i haven't installed anything off of the internet that i was told it was untrusted – River Johnstone Oct 18 '17 at 16:18

2 Answers2

2
REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable  /t REG_DWORD  /f /d 1

Most of the current editions of Windows has the REG command though in some it is missing (e.g Windows XP Home edition)

npocmaka
  • 55,367
  • 18
  • 148
  • 187
  • 1
    @River, this would be my preference over a `.reg` file as it will not trigger the UAC pop-up. Notes: the question tag was for a batch file, in a batch file I'd not echo the actual line and would redirect the output away from the cmd.exe window. _(although these are trivial for a very quickly flashing window)_. I would also shorten the root key: `@Reg Add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /V ProxyEnable /T REG_DWORD /D 1 /F>Nul` – Compo Oct 17 '17 at 13:51
  • so i would put this in a batch file, then into startup directory? – River Johnstone Oct 18 '17 at 16:25
  • @River, yes just copy the single line in my comment to a new file, saved with the `.cmd` extension. If you feel that the startup directory is best then do that. – Compo Oct 19 '17 at 00:30
2

An easy way is to export the registry-key to a .reg-file and remove everything, except the values you want to set. This is also useful when you want to set multiple values at a time.

The contents of the file would then look like this:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings]
"ProxyEnable"=dword:00000001

If you double-click the file, you need to confirm the prompt an the value is set.

You could also create a batch and import the file with:

regedit /s C:\MyPathTo\Whatever.reg

If you want to get rid of the UAC-popup, which will appear when you run the batch-script, you can add set __COMPAT_LAYER=RunAsInvoker at the top of the script:

set __COMPAT_LAYER=RunAsInvoker
regedit /s C:\MyPathTo\Whatever.reg

Reference: What does '__COMPAT_LAYER' actually do?

MatSnow
  • 7,357
  • 3
  • 19
  • 31