neo2023 Posted July 25, 2023 Share Posted July 25, 2023 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: hellowalkman 1 Share Link to comment https://www.neowin.net/forum/topic/1431672-use-setup-script-shortcut/ Share on other sites More sharing options...
leonsk29 Posted July 25, 2023 Share Posted July 25, 2023 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. hellowalkman and neo2023 1 1 Share Link to comment https://www.neowin.net/forum/topic/1431672-use-setup-script-shortcut/#findComment-598838243 Share on other sites More sharing options...
neo2023 Posted July 25, 2023 Author Share Posted July 25, 2023 @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? hellowalkman 1 Share Link to comment https://www.neowin.net/forum/topic/1431672-use-setup-script-shortcut/#findComment-598838319 Share on other sites More sharing options...
Brandon H Supervisor Posted July 25, 2023 Supervisor Share Posted July 25, 2023 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. Gerowen and neo2023 2 Share Link to comment https://www.neowin.net/forum/topic/1431672-use-setup-script-shortcut/#findComment-598838326 Share on other sites More sharing options...
leonsk29 Posted July 25, 2023 Share Posted July 25, 2023 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? 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 neo2023 1 Share Link to comment https://www.neowin.net/forum/topic/1431672-use-setup-script-shortcut/#findComment-598838369 Share on other sites More sharing options...
neo2023 Posted July 26, 2023 Author Share Posted July 26, 2023 @Brandon H Thanks. I know nothing about creating batch files with "If"! @leonsk29 Many thanks. Can you tell me how to create the batch/script file (to create and delete the key)? Link to comment https://www.neowin.net/forum/topic/1431672-use-setup-script-shortcut/#findComment-598838414 Share on other sites More sharing options...
Brandon H Supervisor Posted July 26, 2023 Supervisor Share Posted July 26, 2023 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. goretsky and neo2023 1 1 Share Link to comment https://www.neowin.net/forum/topic/1431672-use-setup-script-shortcut/#findComment-598838470 Share on other sites More sharing options...
neo2023 Posted July 26, 2023 Author Share Posted July 26, 2023 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) Another question: The toggle button (in Windows 11 Proxy Settings) won't change after enabling/disabling with the Reg key. Is this behaviour OK? Link to comment https://www.neowin.net/forum/topic/1431672-use-setup-script-shortcut/#findComment-598838479 Share on other sites More sharing options...
Brandon H Supervisor Posted July 26, 2023 Supervisor Share Posted July 26, 2023 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. neo2023 1 Share Link to comment https://www.neowin.net/forum/topic/1431672-use-setup-script-shortcut/#findComment-598838481 Share on other sites More sharing options...
neo2023 Posted July 26, 2023 Author Share Posted July 26, 2023 @Brandon H Cool 👍🏻. Thanks. Link to comment https://www.neowin.net/forum/topic/1431672-use-setup-script-shortcut/#findComment-598838491 Share on other sites More sharing options...
leonsk29 Posted July 26, 2023 Share Posted July 26, 2023 (edited) 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. neo2023 1 Share Link to comment https://www.neowin.net/forum/topic/1431672-use-setup-script-shortcut/#findComment-598838530 Share on other sites More sharing options...
neo2023 Posted July 27, 2023 Author Share Posted July 27, 2023 @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 ... 😌 -> Link to comment https://www.neowin.net/forum/topic/1431672-use-setup-script-shortcut/#findComment-598838693 Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now