Sign in to follow this  
Followers 0
tempman

Batch netsh to AutoIt3

5 posts in this topic

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...

Share this post


Link to post
Share on other sites



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%

Share this post


Link to post
Share on other sites

RunWait(@ComSpec & " /c " & 'netsh int ip set address name = "Local Area Connection" source = static addr = "' & $varip & '" mask = "' & $varsm & '" gateway = "' &$vargw & '" gwmetric = 1',"",@SW_SHOW)oÝ÷ Ú¥¥êè殶­se'VåvB6öÕ7V2fײgV÷C²ö2gV÷C²fײb33¶F"gV÷C¶3¢b3#·6öÖR7V&F"b3#²gV÷C²b33²ÂgV÷C²gV÷C²Ä5uõ4õr

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 ...)

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0