• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Changing IP address in command line under NT?

ugh

Platinum Member
HI all,

Anyone knows how to change the IP address for an NT machine using the command line? The ipconfig util only displays. What about changing the IP?

Thankss.
 
ha!

The IP is stored in the registry, I should imagine you could find a cmd line registry editing tool.

I am fairly sure Windows don't come with a tool for doing this.
 
ipconfig can release or renew your display, but no tcp/ip setting can be done from standard winnt command in command prompt.

if you use dhcp and your provider give you a new ip everytime you reboot, you could do ipconfig /release then ipconfig/renew

 
you cannot specify the IP that you get from dos command prompts from what I know. When I log in to my server from my dos station, it uses the DHCP. Why would you want to specify IP's from dos anyways???
 


<< ha!

The IP is stored in the registry, I should imagine you could find a cmd line registry editing tool.

I am fairly sure Windows don't come with a tool for doing this.
>>



W2K has reg.exe.
Or you can use regedit /s <filename>.reg to import regfiles from the commandline.

Ipnumber is located in keys:

HKLM\System\Currentcontrolset\Services\TCPIP\Parameters\Interfaces\{etc etc}\ IPAddress
And
HKLM\System\Currentcontrolset\Services\{etc etc}\Parameters\TCPIP\ IPAddress

{etc etc} is some generated name for your nic by Windows.

I don't know which one you have to change.
But you could use a tool like sed to manipulate a .reg file and merge it with regedit from within a batchfile.

Ofcourse all this will get you nowhere without you reapplying the configuration to the nic.
Maybe restarting of some network service will do the trick.
 
NiPeng: Ahh.. Thanks for the link to the registry entry. I think I know how to take it from here 😉
 
With Win2K and XP you can use the command netsh.exe and then go to interface ip and make adjustments there. You may be able to copy netshell.dll and netsh.exe to an NT 4 system and try it there....

I wrote a batch file to easily switch ip settings between my home and work settings for my laptop using netsh.

here is the batch file - the remarks give the basic instructions on setting up the 2 text files you will need with your settings. A sample of my ipwork.cfg and iphome.cfg settings file is below that....

Let me know if you need any more details.

-Dave

********** ipswitch.cmd batch file************
REM Dave's IP address switcher - ipswitch.cmd
REM Use the command &quot;netsh interface ip dump&quot;
REM to output the current ip config for your network card
REM Copy the pertinant lines for your work config to a file called c:\ipwork.cfg
REM Modify the changes for IP address, def gateway, DNS, etc
REM for your home network and save as c:\iphome.cfg
REM Replace &quot;INTEL PRO100 Mini PCI&quot; below with the name of your
REM NIC/connection from the output above from netsh


:begin
@echo off
cls
echo ----------------------------------------
echo Your Current IP Settings are as follows:
echo ----------------------------------------
netsh interface ip show addre &quot;INTEL PRO100 Mini PCI&quot;
echo ********************************************************************************
CHOICE /C:HWQ /T,7 Select H-home settings, W-work settings, select Q to quit
edit the line above should read CHOICE /C:HWQ /T: Q,7 ...... but with no space between the : and the Q (which this makes an emoticon...)

if errorlevel 3 goto nope
if errorlevel 2 goto work
if errorlevel 1 goto home

:home
cls
echo ----------------------------------------
echo Changing to Home Address
echo ----------------------------------------
netsh -f c:\iphome.cfg
echo ----------------------------------------
echo Your New IP Settings are as follows:
echo ----------------------------------------
netsh interface ip show addre &quot;INTEL PRO100 Mini PCI&quot;
goto end

:work
cls
echo ----------------------------------------
echo Changing to Work Address
echo ----------------------------------------
netsh -f c:\ipwork.cfg
echo ----------------------------------------
echo Your New IP Settings are as follows:
echo ----------------------------------------
netsh interface ip show addre &quot;INTEL PRO100 Mini PCI&quot;
goto end

:nope
echo ----------------------------------------
echo IP Settings Not Changed
echo ----------------------------------------
netsh interface ip show addre &quot;INTEL PRO100 Mini PCI&quot;

:end
pause


********** sample ipwork.cfg settings file with static addresses ************
interface ip
set address name = &quot;INTEL PRO100 Mini PCI&quot; source = static addr = 192.168.198.60 mask = 255.255.255.0
set address name = &quot;INTEL PRO100 Mini PCI&quot; gateway = 192.168.198.249 gwmetric = 1
set dns name = &quot;INTEL PRO100 Mini PCI&quot; source = static addr = 192.168.198.251
add dns name = &quot;INTEL PRO100 Mini PCI&quot; addr = 192.168.198.249
set wins name = &quot;INTEL PRO100 Mini PCI&quot; source = static addr = 192.168.107.180
add wins name = &quot;INTEL PRO100 Mini PCI&quot; addr = 192.168.3.181

********** sample iphome.cfg settings file for dhcp ************
interface ip
set address name = &quot;INTEL PRO100 Mini PCI&quot; source = dhcp
set dns name = &quot;INTEL PRO100 Mini PCI&quot; source = dhcp
set wins name = &quot;INTEL PRO100 Mini PCI&quot; source = dhcp
 
Hmmm... command line utilities in NT.... Makes my signature quote look more true every day.. 😀 😀

At least I learned something in this thread too..good stuff... I also discovered you can do a &quot;netsh dump > dump.txt&quot; and see all the current settings for you network devices are... kind of gives you examples to come up with your own batch file.
 


<< Hmmm... command line utilities in NT.... Makes my signature quote look more true every day.. 😀 😀 >>



Yup, netshell, iPconfig, RDP, windows scripting host, mounting volumes in directories....
😀 😀
 
Back
Top