CDG  Change Default Gateway

Copyright 2011-2012 Roberto Bianchi

Softspecialists -


CDG is a Windows program that will let you to temporary or permanently change the default gateway with just one click.

CDG requires at least Windows XP.

Using CDG

You can use CDG for temporary change the default gateway, the change is temporary because the gateway is changed dynamically (no registry are changed) but unless you specify the -n option the program runs in background (as icon in tray area) and the new gateway is keep for the intere session.

Command Line Options

CDG usage: CDG [-b:Browser] [-d] [-f:FileName] [-n] [-w] [-r:IPOldGateway] [-u:URL] IPNewGateway



Full path of browser executable to launch if you don't want start the default one.



Do not start any browser, just change default gateway.



Load settings from file FileName, others cmdline params will override file settings, see details from Configuration File section below.



Start in simple mode (entry, run and exit), no tray icon.



If started in simple mode (-n option) do not wait until the browser will be close.



Gateway IP address to reset on exit(i.e. -r: if you don't want to reset the previosly existing default gateway. If you use this option with both -d and -n you can omit the IPNewGateway parameter.



Web page to open, this option is ignored if the option -d is also specified.



The alternate gateway address to use (i.e. This parameter is mandatory.



If you run CDG  without any parameters the program shows the above help.

Configuration File (.ini file)

You can choose between specify the command line or use a configuration file. Whitin the configuration file you have a small set of keywords that corresponding to the command line options, they are the following:



If No do same behaviour of -n option. Default value is Yes (also if this keyword is not specified).



If No don't start the browser (or any other executable file specified with Browser keyword). Default value is Yes (also if this keyword is not specified). Similar to -d command line option.



If Yes don't wait until the browser (or any other executable file specified with Browser keyword) is closed. Default value is No (also if this keyword is not specified) that is wait for browser. Valid only if TrayIcon=No (or option -n). Similar to -w command line option.



Is the new default gateway to use, same effect of IPNewGateway command line parameter.



Is the default gateway to reset on exit, same effect of -r:IPOldGateway command line option.



Full path of browser (or any other executable file) to start instead of the defoult one. Similar to -b:Browser command line option.



Web page to open. Similar to -u:URL command line option.


If you run CDGSetup without any parameters the program starts in interactive mode showing a dialog window.

With Windows Vista and 7 the User Account Control elevation is required.



CDG -n -d -r:

Permanently change the default gateway to without tray icon and without starting any browser.











Browser=C:\Program Files\Internet Explorer\IEXPLORE.EXE

Configuration file that start a specific browser using the default gateway without tray icon and resetting the default gateway to upon exit internet explorer.



Return Value

CDG returns zero in case of success otherwise returns non zero values.