How do I create a script to log into my router and disable WiFi by double-clicking an icon?

Chinmay S June 1, 2014
Whatsapp Pinterest

How do I turn off WiFi on just double clicking an icon on the desktop? Everyday I have to go to 192.168.1.1 and then uncheck ‘Enable Wireless’ and finally click Submit. I do this everyday multiple times. When I type 192.168.1.1 it opens a box which requires me to enter User and Pass. This all takes a lot of time. I want to create a script which on double click does just that.

  1. Bruce E
    June 2, 2014 at 5:36 pm

    You could try this:

    [Broken Link Removed]

    Some browsers no longer allow this at all while others will allow it if you are sitting on the same subnet.

    • Chinmay S
      June 3, 2014 at 6:32 am

      This works if I paste this link directly in the browser but when i double click on the shortcut it says:
      "Windows cannot find... Make sure you typed name correctly, and then try again."

    • Bruce E
      June 4, 2014 at 4:02 am

      How about saving it as a bookmark in your browser instead?

    • Chinmay S
      June 4, 2014 at 4:15 am

      I don't want to do that. That will increase my steps which i want to reduce. My aim is to double click and turn off, double click and turn on, that's it.

    • Bruce E
      June 4, 2014 at 8:36 am

      I should have asked this with my initial post. Why do you want to keep changing this setting? What benefit do you think you are getting by doing this?

      You can try to be more specific with your link. Include everything in the Target box:
      "C:Program Files (x86)Mozilla Firefoxfirefox.exe" custom link

    • Chinmay S
      June 4, 2014 at 3:10 pm

      There is a limit on the number of characters in the shortcut target box. It's around 260 characters.

      I've added this for the 'off' shortcut:
      "C:Program FilesMozilla Firefoxfirefox.exe" custom link
      This is less than 260 characters so this link works flawlessly.

      This is for 'on' shortcut:
      "C:Program FilesMozilla Firefoxfirefox.exe" custom link

      As you can see it is more than 260 characters so I can't enter the whole thing. So what I did is created a batch file and added this code:

      CD C:Program FilesMozilla Firefox
      start firefox.exe http://admin:admin@192.168.1.1/wlcfg.wl?wlSsidIdx=0&wlEnbl=1&wlHide=0&wlAPIsolation=0&wlSsid=ZTE&wlCountry=IN&wlMaxAssoc=3&wlDisableWme=0&wlEnbl_wl0v1=0&wlSsid_wl0v1=Guest&wlHide_wl0v1=0&wlAPIsolation_wl0v1=0&wlDisableWme_wl0v1=0&wlMaxAssoc_wl0v1=16
      exit;

      But when I run this it doesn't do what it should do. In the address bar it changes to:
      http://username:password@192.168.1.1/wlcfg.wl?wlSsidIdx=0
      For example, if i turn off wifi with the 'off' shortcut and then i run this batch file for turning it on again, WiFi remains turned off. Do you know any way of extending the character limit?

      By the way, when I double click 'off' shortcut, Firefox opens a popup with a message whether I want to confirm that I am entering site with this username. Please see this image:
      http://i.imgur.com/giuXE7n.png

      Is there any way I can remove this popup from Firefox?

    • Bruce E
      June 4, 2014 at 10:35 pm

      Change your batch file to:
      CD C:Program FilesMozilla Firefox

      start firefox.exe "http://admin:admin@192.168.1.1/wlcfg.wl?wlSsidIdx=0^&wlEnbl=1&wlHide=0&wlAPIsolation=0&wlSsid=ZTE&wlCountry=IN&wlMaxAssoc=3&wlDisableWme=0&wlEnbl_wl0v1=0&wlSsid_wl0v1=Guest&wlHide_wl0v1=0&wlAPIsolation_wl0v1=0&wlDisableWme_wl0v1=0&wlMaxAssoc_wl0v1=16"
      exit;

      The double quotes around the URL should prevent the command interpreter from parsing, substituting, or otherwise messing with the URL. If that doesn't work, try inserting a caret (^) before each ampersand (&) in the URL. It is an escape character that should prevent the ampersands from being interpreted as they normally would when the batch file is processed.

      I don't know of a way to prevent Firefox from issuing that popup message. You may want to try running this through Internet Explorer instead. If that one pops up a similar message, simply add 198.162.1.1 to the list of trusted sites in Internet Options and it should stop appearing.

    • Chinmay S
      June 5, 2014 at 2:59 am

      It worked after adding those double quotes. I have also created an entry in Firefox's about:config page which prevents Firefox from opening that popup box. After typing about:config in the address bar, I created a new Integer value called 'network.http.phishy-userpass-length' and set its value to 100000(This value must be a larger number). And that's it, now everything works on double clicking shortcuts.

      Finally my problem is solved. Thank you so much!

  2. Bruce E
    June 1, 2014 at 6:30 am

    Based on the IP address, I would guess you are doing this on your router. In that case, you should be able to make the change once and save the configuration in the router. If this is constantly being reset, you have another problem here.

    As far as scripting, you should be able to establish the secure connection to the router using PowerShell. In order to change the setting itself, you would need to get a network trace using WireShark or a similar tool to find out what is happening to make the change in the first place, then you could send the appropriate commands to the router via HTTP(S).

    • Chinmay S
      June 1, 2014 at 7:12 am

      I have created 2 shortcuts on desktop for turning WiFi off and on. I have added this link to 'on' shortcut:

      custom link

      There is a similar one for turning it 'off' but still i have to enter user and pass to proceed further. When i enter that, it does the rest. But i don't want to enter the user and pass. I just want everything to be automatic just after clicking on the respective 'on' or 'off' shortcut.

      If you can create some kind of code that can enter user and pass without manual interference, then please post that code also.

Ads by Google