Tag Archives: automation

Automating Proxy Settings Changes

I have to switch my proxy settings daily, depending upon being at work or home. I created two batch files to enable/disable the same.

Note that this applies to the global aka Internet Explorer proxy settings.


REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v AutoConfigURL /d "http://www.server.name/proxy" /t REG_SZ /f


REG DELETE "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v AutoConfigURL /f

Control Mouse Speed from Command Line

I use two different mouse devices with my laptop, one in office and one at home. Mouse devices of different manufactures can have different sensitivity. This results in different speeds of the mouse pointer. To adjust the same, one can change the mouse speed from the Control Panel to achieve same speed or same experience with different mouse devices.

This has become a daily task for me. Twice a day, I have to change the pointer speed from the control panel. I thought of automating the process of changing the mouse speed to save myself from daily manual painful steps.

For part of the solution, I wrote a small utility program called changeMouseSensitivity.exe for changing the mouse speed. You can call this program from the command line passing mouse speed value (integer between 1 and 20) as the argument. This sets the mouse speed to the given value.

I calibrated both my mouse devices and found that the value of 6 for mouse_home and value of 14 for mouse_office gives me the same speed. I created two batch files mouse_home.bat and mouse_office.bat and in these two files I set the required speed values by calling the utility changeMouseSensitivity.exe. Following are the two bat files:

changeMouseSensitivity.exe 6
changeMouseSensitivity.exe 14

I created shortcuts to these two batch files on my desktop and every time I change my mouse (that is my location changes) I launch the respective bat file.

I’m liking this setup. It has reduced my total number of clicks from 7 to 1 double-click.

In future, there is a scope of automating the process completely. Complete automation requires detection of the connected mouse and setting the respective speed when mouse is connected.

Following is the source of the utility changeMouseSensitivity.exe. It is written in C++.

#include <stdio.h>
#include <tchar.h>
#include "Windows.h"

int _tmain(int argc, _TCHAR* argv[])
 if(argc == 2)
 int value = _tstoi(argv[1]);

 if(value > 20 || value <1)
 printf("\nFailure: the value should be between 1 and 20\n");
 return 0;

 BOOL result = SystemParametersInfo(SPI_SETMOUSESPEED, 0, (void*)value, 0);
 printf("  changeMouseSensitivity <interger value between 1 and 20>\n");

 return 0;