Change IP address by just one click?


Recommended Posts

You can do this by creating 2 batch files.

1. First, change the IP address manually to the first IP address

2. Run a Command box and enter "netsh interface dump > c:\windows\ip1.txt" (without quotes) and press enter

3. Exit the Command Box

4. Now change the IP address manually again to the second IP address

5. Run a Command box and enter "netsh interface dump > c:\windows\ip2.txt" (without quotes) and press enter

Batch file 1:

@echo off
echo Changing IP Address to IP Address 1
netsh exec c:\windows\ip1.txt

Batch file 2:

@echo off
echo Changing IP Address to IP Address 2
netsh exec c:\windows\ip2.txt

Now all you have to do is run the appropiate batch file to configure the PC to use that IP address. Just remember not to delete the two text files created. And if you add a shortcut in the quick launch tool bar for each of the batch files, just one click to change like you requested.

Edited by john.porter

Just what i was looking for, thanks a lot =)

Edit: One weird thing though, default gateway stays blank where you normally change IP address, even though everything works fine. What's the reason for this?

Edited by Nitrius

Glad to be of help.

This can also be used to save your setting for backing up purposes or if you are re-formatting etc. If anyone is interested I have a batch file which will save, and restore setting if you pass it parameters and the name of the file.

  Nitrius said:
Just what i was looking for, thanks a lot =)

Edit: One weird thing though, default gateway stays blank where you normally change IP address, even though everything works fine. What's the reason for this?

Again, you have to manually set your network settings before creating this file. This works without fail for me on my Vista system.

Look in one of the text files for the following line:

set address name="<Name of your Connection>" gateway=XXX.XXX.XXX.XXX gwmetric=0 (where XXX.XXX.XXX.XXX is your gateway address)

Is that line there?

If not, Repeat Steps 1-5 again, making sure when you manually set the IP address you set the subnet mask, the default gateway and the dns server settings.....

It works, it's just that the gateway box is empty, though if you check details under customize in the vista network console you can see the gateway address, it's like it been inputted into another place.

Here is how the "dump" ip1/2.txt files looks:

#========================
# Interface configuration
#========================
pushd interface

reset all


popd
# End of interface configuration



# ----------------------------------
# IPv4 Configuration
# ----------------------------------
pushd interface ipv4

reset
set global icmpredirects=enabled
add route prefix=0.0.0.0/0 interface="Local Area Connection" nexthop=xxx.xxx.xxx.xxx
add address name="Local Area Connection" address=xxx.xxx.xxx.xxx


popd
# End of IPv4 configuration



# ----------------------------------
# IPv6 Configuration
# ----------------------------------
pushd interface ipv6

reset


popd
# End of IPv6 configuration



# ----------------------------------
# ISATAP Configuration
# ----------------------------------
pushd interface isatap



popd
# End of ISATAP configuration



# ----------------------------------
# 6to4 Configuration
# ----------------------------------
pushd interface 6to4

reset



popd
# End of 6to4 configuration



# ----------------------------------
# ISATAP Configuration
# ----------------------------------
pushd interface isatap



popd
# End of ISATAP configuration


\#========================
\# Port Proxy configuration
\#========================
pushd interface portproxy

reset


popd

# End of Port Proxy configuration



# ----------------------------------
# TCP Configuration
# ----------------------------------
pushd interface tcp

reset

set global rss=enabled chimney=disabled autotuninglevel=normal congestionprovider=none ecncapability=disabled timestamps=disabled


popd
# End of TCP configuration



# ----------------------------------
# Teredo Configuration
# ----------------------------------
pushd interface teredo
set state servername=teredo.ipv6.microsoft.com.



popd
# End of Teredo configuration



# ----------------------------------
# 6to4 Configuration
# ----------------------------------
pushd interface 6to4

reset



popd
# End of 6to4 configuration

Found another way:

netsh interface ip set address name="Local Area Connection" static IP-ADDRESS SUBNET-MASK DEFAULT-GATEWAY

Just added that into the batch files, one with each IP address, and it seems to work, just as your method did john, just that now the gateway doesn't disappear from the "default gateway" box.

Edited by Nitrius
  Nitrius said:
Found another way:

netsh interface ip set address name="Local Area Connection" static IP-ADDRESS SUBNET-MASK DEFAULT-GATEWAY

Just added that into the batch files, one with each IP address, and it seems to work, just as your method did john, just that now the gateway doesn't disappear from the "default gateway" box.

Fantastic. Glad you got it to work.

Yup calling netsh commands is the easiest fastest way to make changes to your ip and or other settings be it static or dhcp, dns, gateways, wins, etc.. etc.

But I am curious on why your needing to do this? If switching between network, do you not have dhcp? If this in home setup maybe you could change your networks around so you would not have to switch IPs etc.

If you gave us the details -- maybe it would be possible to allow you to do what your wanting to do with no clicks ;)

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Isn't the CPU used to calculate the parity for the RAID? If so, the combination of SSDs and 10GBe might make the CPU more important
    • yeah GSMA began working to enable end to end encryption between android and iphone last year and apparently a new standard was developed. apple has said that they would implement this in "future software updates" but i haven't heard anything since march, the time this was all reported on. shortly after, i read on forbes that the FBI suggests not sending texts between iphone and android because they're unencrypted. i use signal to chat with my wife but i'd rather just use messages tbh (she has an iphone), i'm not really a 3rd party guy haha
    • Well, I did not like the trailer for the project he went to work on also, but why do you think he should waste time with this… did you love the season 2? Maybe I am missing out after the crap I saw in first season ep1-3? I love the first last of us game… while not the BEST it was one of the games that I will remember for the EXPERIENCE it game me… last of us 2 was not on the same level at all and the show🤔 complete miss in my experience of the first few level
    • They're likely moving all resources to other things. Clearly Windows is not important to them.
    • Image Uploader 1.4.3 Build 5352 by Razvan Serea Image Uploader is a free and open-source program for Windows that that allows you to effortlessly upload images, screenshots, and various files to a wide array of hosting services. With its capability to capture selected screen areas, it promptly uploads content to image hosting services, while also offering the convenience of automatically copying the URL to your clipboard. Key Features of Image Uploader: Upload to Multiple Hosting Services Image Uploader supports uploading images and files to over 30 popular hosting services. Additionally, it can upload directly to your own FTP, SFTP, or WebDAV server. After upload, the tool automatically generates sharing codes in HTML, BBCode, and Markdown, with support for custom output templates tailored to your needs. Video Frame Grabbing and Screenshot Tools You can extract multiple frames from video files in a wide range of formats including AVI, MP4, MKV, WMV, and more. It supports both system-installed codecs and built-in ones. The extracted frames can be uploaded individually or compiled into a single mosaic image. It also includes screenshot capabilities for the full screen or selected regions, along with a simple image editor for annotations, highlights, and blurring. Advanced Integration and Usability Image Uploader supports drag-and-drop, clipboard monitoring, and can be accessed via Windows Explorer’s context menu. It also features URL shortening, multi-account support, reuploading, and the ability to upload images embedded in text while retaining formatting. The app is available in several languages, including English, Russian, Turkish, Korean, Arabic, and more. Image Uploader 1.4.3 Build 5352 changelog: New Features Screen Recording: Added two powerful capture methods: DirectX (Desktop Duplication API) FFmpeg-based recording Expanded Hosting Services: Added support for new file hosting platforms: TeleBox (linkbox.to) take-me-to.space ranoz.gg webshare.cz lobfile.com imgpx.com freeimghost.net radikal.cloud anonpic.org fotozavr.ru imgtr.ee thumbsnap.com 8upload.com filemail.com Others Video Uploads: Added Flickr.com support for video uploads Localization: New French translation added Context Menu: Added "File Information" option to video file context menus DPI Support: Improved support for: Screen DPI changes Mixed-DPI multi-monitor setups Improvements Disabled application window animations during screenshot/screen recording initiation Updated API and documentation Improved overall stability Bug Fixes Fixed network client error that could cause application crashes Resolved unauthorized startup registration issue Fixed upload functionality for pixeldrain.com Restored tray icon balloon notifications visibility Various minor bug fixes Download: Image Uploader 64-bit | Portable 64-bit | ~16.0 MB | (Open Source) Download: Image Uploader 32-bit | Portable 32-bit | ~15.0 MB Download: Image Uploader ARM64 | Portable ARM64 | ~11.0 MB Links: Image Uploader Home Page | Screenshot | GitHub Get alerted to all of our Software updates on Twitter at @NeowinSoftware
  • Recent Achievements

    • Reacting Well
      SteveJaye earned a badge
      Reacting Well
    • One Month Later
      MadMung0 earned a badge
      One Month Later
    • One Month Later
      Uranus_enjoyer earned a badge
      One Month Later
    • Week One Done
      Philsl earned a badge
      Week One Done
    • Week One Done
      Jaclidio hoy earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      429
    2. 2
      ATLien_0
      156
    3. 3
      +FloatingFatMan
      149
    4. 4
      Nick H.
      64
    5. 5
      +thexfile
      62
  • Tell a friend

    Love Neowin? Tell a friend!