Jump to content

Batch netsh to AutoIt3


Recommended Posts

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...
Link to comment
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%
Link to comment
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

Link to comment
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
Link to comment
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 ...)
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...