CDG  Change Default Gateway

Copyright 2011-2012 Roberto Bianchi

Softspecialists - www.softspecialists.com

Introduction

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

 

-b:Browser

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

 

-d

Do not start any browser, just change default gateway.

 

-f:FileName

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

 

-n

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

 

-w

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

 

-r:IPOldGateway

Gateway IP address to reset on exit(i.e. -r:192.198.0.1) 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.

 

-u:URL

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

 

IPNewGateway

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

     

Note

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:

 

TrayIcon

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

 

StartBrowser

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.

 

DontWaitForBrowser

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.

 

SetNewGatewayAddressTo

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

 

ResetOldGatewayAddressTo

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

 

Browser

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

 

URL

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.

USE EXAMPLE:

 

CDG -n -d 192.168.0.10 -r:192.168.0.1

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

     

 

INI FILE EXAMPLE:

 

[Settings]

TrayIcon=No

StartBrowser=Yes

DontWaitForBrowser=Yes

SetNewGatewayAddressTo=192.198.0.12

ResetOldGatewayAddressTo=192.198.0.1

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

URL=www.softspecialists.com

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

     

 

Return Value

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