Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: How to assign two IP address in one NIC card using batch script  (Read 2785 times)

0 Members and 1 Guest are viewing this topic.

santhoshc86

  • Guest
How to assign two IP address in one NIC card using batch script
« on: October 04, 2011, 01:31:56 AM »
Hello All,

Do anybody know how to assign two or more IP address in one NIC card using batch script in Windows. I currently i use the below batch script to assign one IP address, then i manually assign another IP address. I searched everywhere in net, could not find idea on this.

One more problem is run the script it executes the first line, it opens chrome and does not executes rest of the lines until i close chrome browser. I tried different option for this "start command.....etc" but nothing worked out.

Please help me out.


#################################


"C:\Documents and Settings\Administrator\Local Settings\Application Data\Google\Chrome\Application\chrome.exe"


start D:\santhosh\SBM

start D:\santhosh\DOCUMENTS

start D:\santhosh\SBM\SBM-TOKYO



@ECHO OFF


ECHO Enter input for IP assigning static or dhcp


set /P INPUT=

if %INPUT% == "dhcp" goto  :dhcp

if %INPUT% == "static" goto :static


:dhcp
:: ECHO Resetting IP Address and Subnet Mask For DHCP   [line commented]
netsh int ip set address name = "Local Area Connection" source = dhcp

:: ECHO Resetting DNS For DHCP
::netsh int ip set dns name = "Local Area Connection" source = dhcp

:: ECHO Resetting Windows Internet Name Service (WINS) For DHCP
::netsh int ip set wins name = "Local Area Connection" source = dhcp
:end


:static
netsh interface ip set address name = "Local Area Connection" source = static addr = 172.16.241.224 mask = 255.255.255.0
:end

###############################

Raven19528



    Hopeful
  • Thanked: 30
    • Computer: Specs
    • Experience: Experienced
    • OS: Windows 7
    Re: How to assign two IP address in one NIC card using batch script
    « Reply #1 on: October 06, 2011, 10:48:24 PM »
    For your second problem, using a simple "start C:\Documents and Settings\Administrator\Local Settings\Application Data\Google\Chrome\Application\chrome.exe" should start the program and continue on with the batch. If not, you may want to check whether command extensions are enabled or disabled. If enabled, try to write the script to disable the extensions, then start the program, then re enable command extensions afterwards.

    Code: [Select]
    setlocal disableextensions
    start C:\Documents and Settings\Administrator\Local Settings\Application Data\Google\Chrome\Application\chrome.exe
    endlocal

    To set a second IP, I need to ask if you are trying to set an IP for a seperate connection or if you are wanting the one "Local Area Connection" to have two IP addresses. If this is what you are wanting, how exactly are you setting it "manually?"
    "All things that are
    Are with more spirit chased than enjoy'd" -Shakespeare