AzKay Posted June 27, 2006 Share Posted June 27, 2006 Well, I saw somehwere you can make batch files to do it This one changes it: @Echo Setting IP address to <Your NEW IP> @Echo Off netsh interface ip set address name="Local Area Connection" static <THE NEW IP> <SUBNET MASK> <DEFAULT GATEWAY> 1 This one changes it back: @Echo Setting IP address to DHCP assigned. @Echo Off netsh interface ip set address "Local Area Connection" dhcp @Echo Setting DNS to DHCP assigned. @Echo Off netsh interface ip set dns "Local Area Connection" dhcp So, would it be possible to do something like this using autoit? # MY LOVE FOR YOU... IS LIKE A TRUCK- # Link to comment Share on other sites More sharing options...
w0uter Posted June 27, 2006 Share Posted June 27, 2006 take a look at @COMSPEC. My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
Xenobiologist Posted June 27, 2006 Share Posted June 27, 2006 take a look at @COMSPEC.Hi,I think what w0uter means it, every batch command can be run like it is with _RunDOS() or Run( ... @COMSPEC...)So long,Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
sandyd Posted June 27, 2006 Share Posted June 27, 2006 (edited) I created a script for users who move between our different depots with their laptops. Here is the SwitchDepot function. It pulls the info from an ini file, but you should be able to deciper what is going on. Func SwitchDepot($aDepot) SplashTextOn('','Switching Depot, Please wait ...') RunAsSet('administrator',@ComputerName,'merc230') $DepotIPType = IniRead($IniFileName, $aDepot, "Type", "Not Found") If $DepotIPType = 'DHCP' Then $Result = RunWait(@ComSpec & " /c " & 'netsh interface ip set address "Local Area Connection" dhcp','c:\',@SW_HIDE) Else $ipaddr = IniRead($IniFileName,$aDepot,'ipaddr','') $subnetmask = IniRead($IniFileName,$aDepot,'subnetmask','') $gateway = IniRead($IniFileName,$aDepot,'gateway','') $metric = IniRead($IniFileName,$aDepot,'metric','') $Result = RunWait(@ComSpec & " /c " & 'netsh interface ip set address "Local Area Connection" static ' & $ipaddr & ' ' & $subnetmask & ' ' & $gateway & ' ' & $metric,'c:\',@SW_HIDE) $DnsArray = StringSplit(IniRead($IniFileName,$aDepot,'dns',''),'|') If $DnsArray[0] <> 0 Then For $i = 1 To $DnsArray[0] If $i = 1 Then $Result = RunWait(@ComSpec & " /c " & 'netsh interface ip set dns "Local Area Connection" static ' & $DnsArray[$i] & ' primary','c:\',@SW_HIDE) Else $Result = RunWait(@ComSpec & " /c " & 'netsh interface ip add dns "Local Area Connection" ' & $DnsArray[$i] & ' index=' & $i,'c:\',@SW_HIDE) EndIf Next EndIf EndIf SplashOff() EndFunc Edited June 27, 2006 by sandyd ----[ SandyD ]--- Link to comment Share on other sites More sharing options...
Xenobiologist Posted June 27, 2006 Share Posted June 27, 2006 HI, maybe you should **** your password. So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
AzKay Posted June 27, 2006 Author Share Posted June 27, 2006 Thanks, Ill try it out # MY LOVE FOR YOU... IS LIKE A TRUCK- # Link to comment Share on other sites More sharing options...
sandyd Posted June 28, 2006 Share Posted June 28, 2006 Oops maybe I should have! ----[ SandyD ]--- Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 28, 2006 Moderators Share Posted June 28, 2006 That's nice sandyd... but I think he was talking about your public IP maybe not ? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Elkie Posted June 6, 2007 Share Posted June 6, 2007 It won't work if the connection name is different, not "Local Area Connection". Best is use WMI Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now