• We should now be fully online following an overnight outage. Apologies for any inconvenience, we do not expect there to be any further issues.

Is it possible to make a .bat file to do this?

EQTitan

Diamond Member
Jun 4, 2004
4,031
0
71
I'm wondering if there is a way to create a .bat file (I think it's a .bat file)

Double click .bat

Enable LAN if disabled
changes DNS of Local Area Connection to 4.2.2.1 (primary) 4.2.2.2 (secondary)
close

Need that to work on Windows98 - XP


and also need one to do this

Enable LAN if disabled
Change LAN IP to 192.168.100.10
Subnet to 255.255.255.0
close
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
I don't think you can change that stuff on the fly in Win9X so that's probably out, but you should be able to do all of that for XP with netsh.
 

EQTitan

Diamond Member
Jun 4, 2004
4,031
0
71
Any idea on how to write it out. The only command I know for netsh is "netsh reset winsock"....
 

EQTitan

Diamond Member
Jun 4, 2004
4,031
0
71
From the netsh command site of Microsoft

Example : set dns [name=]InterfaceName [source=]{dhcp | static [addr=]{DNSAddress | none}} [[ddns=]{disabled | enabled}] [[suffix=]{interface | primary}]

DNS would be static, with primary 4.2.2.1 secondary 4.2.2.2
 

EQTitan

Diamond Member
Jun 4, 2004
4,031
0
71
Ok, found a nice little .bat file that calls out to .txt files but I still can't make the alternate DNS change. I need the alt to be 4.2.2.2 Can anyone point me in the right direction?

ConfigIP.bat file
@echo off
title Black Lunchbox IP Configuration Batch File - 2007
setlocal
set OK=N



:start
set /p choice=Please enter 1[Setup Modem], 2[Change DNS], 3[Restore DHCP] or END ??
if /i [%choice%]==[END] endlocal&goto end
if [%choice%]==[] goto start
if [%choice%]==[1] goto 1
if [%choice%]==[2] goto 2
if [%choice%]==[3] goto 3
set /p xxx=wrong entry, press any key to exit.
endlocal
goto end



:1
echo NIC setting for Setup Modem being configured.....
@netsh exec setup.txt
set /p see=IP changed successfully to Setup Modem [9]see new setting [Enter]exit...
if [%see%]==[9] goto show
echo Ending IP Configuration
goto end



:2
echo NIC setting for Change DNS being configured.....
@netsh exec dns.txt
set /p see=IP changed successfully to DNS Settings [9]see new setting [Enter]exit...
if [%see%]==[9] goto show
echo Ending IP Configuration
goto end



:3
echo NIC setting for Work being configured.....
@netsh exec restore.txt
set /p see=IP changed successfully to Restore Settings [9]see new setting [Enter]exit...
if [%see%]==[9] goto show
echo Ending IP Configuration
goto end



:show
@netsh int ip show config



:end
@echo on
cls

dns.txt
# ----------------------------------
# Interface IP Configuration
# ----------------------------------
pushd interface ip


# Interface IP Configuration for "Local Area Connection"
set address name="Local Area Connection" source=DHCP
set dns name="Local Area Connection" source=static addr=4.2.2.1 register=primary


popd
# End of interface IP configuration