"Use setup script" Shortcut


Recommended Posts

Hi forum,

Is there a way to create a shortcut from the PAC setting in Windows 11?

Windows Settings> Network & Internet> Proxy> Use setup script

A shortcut for this toggle button:

image.png.1af468981ec455230707982732a7d73d.png

  • Like 1
Link to comment
Share on other sites

I don't know how to create a GUI shortcut to that, but I can tell you where those settings are located in the Registry:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings

If you browse to that using Registry Editor, you will see (or you will have to create) a REG_SZ value named "AutoConfigURL". If that value exists and contains a URL, the setting is activated. If you delete the value or empty it, the setting is disabled. Maybe you can work with that to create a script or a .reg file that enables or disables it with a simple double click. Let me know if you need more help.

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

@leonsk29ย Many thanks. I found the key. By enabling the toggle button (in Windows 11 Proxy Setting), the key would be created and by toggling it off, the key would be removed automatically ๐Ÿ‘๐Ÿป.
I want to convert this key to a shortcut. I can export the key and double-click on it to enable the PAC. What do I have to do to remove the key from Registry?

image.png.5257dd821b4e6759368d199506ab1f06.png

ย 

  • Like 1
Link to comment
Share on other sites

you could create a simple batch or powershell script for that. just do an 'if exists' check then delete or create based on if the key is presently found or not.

  • Like 2
Link to comment
Share on other sites

On 25/07/2023 at 15:51, neo2023 said:

@leonsk29ย Many thanks. I found the key. By enabling the toggle button (in Windows 11 Proxy Setting), the key would be created and by toggling it off, the key would be removed automatically ๐Ÿ‘๐Ÿป.
I want to convert this key to a shortcut. I can export the key and double-click on it to enable the PAC. What do I have to do to remove the key from Registry?

image.png.5257dd821b4e6759368d199506ab1f06.png

ย 

I would use the "reg delete" command inside a batch file to double click it and remove the "AutoConfigURL" value when I want the setting to be disabled. That's one of many ways to do it, though.

Something like:

reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v AutoConfigURL

Link to comment
Share on other sites

On 26/07/2023 at 01:57, neo2023 said:

@Brandon Hย Thanks. I know nothing about creating batch files with "If"!

Here try this :)ย I use batch scripts all the time at work to help automate work arounds and fixes

@echo off
title Toggle Proxy Auto Config URL

reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v AutoConfigURL

if %errorlevel% == 0 (goto Delete) else (goto Add)

:Add
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v AutoConfigURL /t REG_SZ /d https://wwww.domain.here
cls
echo Proxy Auto Config URL enabled
pause
exit

:Delete
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v AutoConfigURL
cls
echo Proxy Auto Config URL removed
pause
exit

Note: save this in to a .bat file and replace the URL on the :Add line with your real URL.

Link to comment
Share on other sites

Thanks ๐Ÿ™๐Ÿป. What code do I have to add to disable showing this confirmation dialogue? I want to run the bat file in "Quiet" mode (no CMD window and no confirmation dialogue). Just click on the "bat" file to enable/disable automatically. I have heard, bat files can be run without showing the window (CMD Window). Could it be possible here?

1= Click on the Bat file

2= Click on the Bat file to disable the PAC

3= Extra click to close the window (after confirmation=Yes)

image.png.aecd679bbd38cc0e600468f91781961c.png

Another question: The toggle button (in Windows 11 Proxy Settings) won't change after enabling/disabling with the Reg key. Is this behaviour OK?

image.png.f7555036326e9da284277d7607778b11.png

Link to comment
Share on other sites

On 26/07/2023 at 08:58, neo2023 said:

Thanks ๐Ÿ™๐Ÿป. What code do I have to add to disable showing this confirmation dialogue? I want to run the bat file in "Quiet" mode (no CMD window and no confirmation dialogue). Just click on the "bat" file to enable/disable automatically. I have heard, bat files can be run without showing the window (CMD Window). Could it be possible here?

yeah, the end pause was for your confirmation but if you prefer without that then try this instead (also fixed the delete confirmation)

@echo off
title Toggle Proxy Auto Config URL

reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v AutoConfigURL

if %errorlevel% == 0 (goto Delete) else (goto Add)

:Add
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v AutoConfigURL /t REG_SZ /d https://wwww.domain.here
exit

:Delete
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v AutoConfigURL /f
exit

ย 

On 26/07/2023 at 08:58, neo2023 said:

Another question: The toggle button (in Windows 11 Proxy Settings) won't change after enabling/disabling with the Reg key. Is this behaviour OK?

Not sure on this one, could just be it gets out of sync when you change via registry or could be an additional key is needed to toggle on/off.

Link to comment
Share on other sites

Brandon H gave you everything you need. Glad I could help. Cheers!

PS: the UI won't change immediately after modifying the Registry, that's normal. You need to close and reopen the GUI to see the change, that forces Settings to re-read the Registry and adjust itself accordingly. You don't need to worry about that. Many Windows UI components are just that: a front-end for the user to easily change Registry settings without having to use Registry Editor.

Link to comment
Share on other sites

@leonsk29Thanks ๐Ÿ‘๐Ÿป. I realized the change (toggle on/off) isn't real-time. I have to close and re-open the Settings. I hope MS add a specific icon for Script proxy to the network icon. An indicator to show PAC use by the network connection (like the latest Win 11 update). I want to get rid of going there to check the on/off status. Unfortunately, I have to turn it on and off many times in an hour!!! I have to browse some URLs directly (with no VPN/Proxy), and some have to be accessed by VPN/Proxy. Frustrating!ย 
The reason: My rubbish Internet Provider/Carrier censorship policy (in my region).

My dreams ... ๐Ÿ˜Œ ->ย ย image.png.1eb31e994c9b96d47c49cb2cf9c76d26.pngย 

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
  • Recently Browsing   0 members

    • No registered users viewing this page.