Listing 1: The :PREP Section from SetIP.cmd :PREP :: Set a default IP address and assume static addressing, then check and :: set to dhcp if needed. Set to default local area connection unless we :: later find the user selected wireless. Setlocal Set NicType=Local Set doDNS=Yes Set ipAddr=192.168.1.2 Set ipMask=255.255.255.0 Set dns=4.2.2.2 :: Options for ipType are 'static' and 'dhcp'. Set ipType=static ::We assume the first paramater is the IP address, so let's grab it. If Not {%1}=={} Set ipAddr=%1 & Shift ::If it ends with a space, drop that character. If "%ipAddr:~-1,1%"==" " Set ipAddr=%ipAddr:~0,-1% :: Now, we have to check that it isn't actually one of the other possible ::parameters. If it is, save that and revert to the original default IP address. If "%ipAddr%"=="mask" Set ipMask=%2 & Set ipAddr=192.168.1.2 If "%ipAddr%"=="gw" Set ipGw=%2 & Set ipAddr=192.168.1.2 If "%ipAddr%"=="/w" Set NicType=Wireless & Set ipAddr=192.168.1.2 If "%ipAddr%"=="-w" Set NicType=Wireless & Set ipAddr=192.168.1.2 If "%ipAddr%"=="/nodns" Set doDNS= & Set ipAddr=192.168.1.2 If "%ipAddr%"=="-nodns" Set doDNS= & Set ipAddr=192.168.1.2 If "%ipAddr%"=="dhcp" Set ipType=source=dhcp & Set ipAddr= & Set dns= & Set ipMask= If "%ipType%"=="static" Set metric=1 & Set register=none Goto GetCmdLine