Jump to content

Recommended Posts

Posted

Hi,

these are a batch command for changing IP and Subnet mask

netsh int ip delete address name = "Local Area Connection" gateway = all 
netsh int ip set address name = "Local Area Connection" source = static addr = %varip% mask = %varsm%

and these for changing IP, Subnet mask and Gateway

netsh int ip set address name = "Local Area Connection" source = static addr = %varip% mask = %varsm% gateway = %vargw% gwmetric = 1

these are variables

%varip%  ----> $varip
%varsm%  ----> $varsm
%vargw%  ----> $vargw

I nead it in AutoIt3 script separately

RunWait(@ComSpec & " /c...
Posted

I figure it out second one:

netsh int ip set address name = "Local Area Connection" source = static addr = %varip% mask = %varsm% gateway = %vargw% gwmetric = 1

RunWait(@ComSpec & " /c " & '"netsh int ip set address name = "Local Area Connection" source = static addr = "' & $varip & '" mask = "' & $varsm & '" gateway = "' &$vargw & '" gwmetric = 1"',"",@SW_SHOW)

My enigma is first one because for two lines...

netsh int ip delete address name = "Local Area Connection" gateway = all 
netsh int ip set address name = "Local Area Connection" source = static addr = %varip% mask = %varsm%
Posted

Thanks

But obviously am slow...

I nead these two lines to convert in AutoIt script @ComSpec command

In *.bat they execute one by one in same Command Promt...

netsh int ip delete address name = "Local Area Connection" gateway = all   <- ENTER

netsh int ip set address name = "Local Area Connection" source = static addr = %varip% mask = %varsm%   <- ENTER
Posted

I nead these two lines to convert in AutoIt script @ComSpec command

In *.bat they execute one by one in same Command Promt...

netsh int ip delete address name = "Local Area Connection" gateway = all   <- ENTER

netsh int ip set address name = "Local Area Connection" source = static addr = %varip% mask = %varsm%   <- ENTER
Just use two RunWait() for each netsh

pseudocode:

RunWait(netsh int ip delete ...)
RunWait(netsh int ip set ...)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...