Enable/Disable TCP/IP from Command Prompt
Moderator: DosItHelp
Enable/Disable TCP/IP from Command Prompt
Hi all,
is there a way (using pure DOS commands and/or other* tools (vbs, power shell etc.) to achieve this:
I would like to be able to Enable/Disable TCP/IP from DOS prompt, the same as doing this via GUI:
- Network Connections -> select your LAN connection -> scroll down to Internet Protocol (TCP/IP) and select/deselect check box on the left (enable/disable). Of corse when disabling there is a warning that some other components will be disabled. Of course I click Yes.
Is this possible from a command prompt?
Thanks,
Saso
* other tools: standalone .exe or something (.vbs, .cmd...) - no installation required.
is there a way (using pure DOS commands and/or other* tools (vbs, power shell etc.) to achieve this:
I would like to be able to Enable/Disable TCP/IP from DOS prompt, the same as doing this via GUI:
- Network Connections -> select your LAN connection -> scroll down to Internet Protocol (TCP/IP) and select/deselect check box on the left (enable/disable). Of corse when disabling there is a warning that some other components will be disabled. Of course I click Yes.
Is this possible from a command prompt?
Thanks,
Saso
* other tools: standalone .exe or something (.vbs, .cmd...) - no installation required.
Re: Enable/Disable TCP/IP from Command Prompt
This should disconnect the connection:
ipconfig /release
This should renew the connection:
ipconfig /renew
I don't know if Windows will automatically try to renew the connection after a while or not. You can specify the adapter with ipconfig too.
ipconfig /release
This should renew the connection:
ipconfig /renew
I don't know if Windows will automatically try to renew the connection after a while or not. You can specify the adapter with ipconfig too.
Re: Enable/Disable TCP/IP from Command Prompt
netsh interface set interface "Interface name" DISABLED
Re: Enable/Disable TCP/IP from Command Prompt
@foxidrive: I will try this later (to avoid IP conflicts I cannot do it now).
@Squashman: this will probably disable the whole interface. I need only TCP/IP enable/disable option - all other protocols must be active.
Thank you both.
Saso
@Squashman: this will probably disable the whole interface. I need only TCP/IP enable/disable option - all other protocols must be active.
Thank you both.
Saso
Re: Enable/Disable TCP/IP from Command Prompt
Well you could use Netsh to change the IP address to some non routable IP address on your network and then change it back to whatever when needed.
http://www.petri.co.il/configure_tcp_ip_from_cmd.htm
http://www.petri.co.il/configure_tcp_ip_from_cmd.htm
Re: Enable/Disable TCP/IP from Command Prompt
Give this a try.
netsh int ipv4 uninstall
netsh int ipv4 install
netsh int ipv4 uninstall
netsh int ipv4 install
Re: Enable/Disable TCP/IP from Command Prompt
Squashman wrote:Give this a try.
netsh int ipv4 uninstall
netsh int ipv4 install
I think that while this should work ipv4, any TCP/IP configuration changes will be lost like RWIN factors etc, if it sets TCP/IP back to default values.
Re: Enable/Disable TCP/IP from Command Prompt
foxidrive wrote:This should disconnect the connection:
ipconfig /release
This should renew the connection:
ipconfig /renew
If the network adapter has a fixed IP address this may not work - I think it only works for DHCP negotiated connections.
Re: Enable/Disable TCP/IP from Command Prompt
Yes, it works with fixed IP address (and much faster).foxidrive wrote:If the network adapter has a fixed IP address this may not work - I think it only works for DHCP negotiated connections.
Re: Enable/Disable TCP/IP from Command Prompt
I still have to do/try this. Will do in the near future.
Thanks,
Saso
Thanks,
Saso