Skip to main content

With one network card in their PC or laptop, Galil users often wish to choose between two different network setups: DHCP for their Internet Connection, and a Static, Closed network for Galil Application development. Below is a Windows batch file which helps to make this transition easily. Install GalilTools first, and then copy the code text below to a file called GalilNetworkConfig.bat. Double clicking a batch (bat) file runs the contained script.

Here's what the script does:

1.) Saves a copy of the current network configuration to a file
2.) Sets "Local Area Connection" to static, 192.168.1.1, with a subnet of 255.255.255.0
3.) Launches GalilTools
4.) Once GalilTools process ends, it restores the network connections saved in 1

@Echo Off
Color F0
title LEAVE OPEN to restore network after GalilTools

REM create a file for the backup.  Use a random number suffix for semi-unique filename
Set GalilFile= GalilNet%random%.txt
CLS

Echo *** Backing Up Current Network Settings to %GalilFile% ***
Echo Current Settings:

REM display network data to screen and backup to dump file (for debugging)
ipconfig
Echo %date% %time% >> ipconfigDump.txt
ipconfig >> ipconfigDump.txt

REM dump current network config to backupfile
netsh -c interface dump > %GalilFile%
REM create a restore batch file in case this script is exited before restoration. Just run this batch and the old settings will restore
ECHO netsh -f %GalilFile% > RELOAD-LAST.bat

Echo.
Echo *** Preparing Network Connection for GalilTools ***
REM setup for Galil Controller
netsh interface ip set address name="Local Area Connection" source=static addr=192.168.1.1 mask=255.255.255.0
Echo.
Echo *** Network changed ***
Echo New Settings:

REM display network data to screen again
ipconfig

REM launch GalilTools
Echo *** Launching GalilTools ***
"c:\program files\galil\galiltools-x86\bin\galiltools"

REM when the GalilTools process exits, the old settings will be reset
Echo *** Loading Settings from %GalilFile% ***
Netsh -f %GalilFile%
Echo Current Settings:
ipconfig

REM leave the config file, but delete the restore batch file
REM del %GalilFile%
del RELOAD-LAST.bat