autoitNOW Posted July 6, 2004 Share Posted July 6, 2004 (edited) The below command has "local" (which is also a variable... global/dim) in it and despite the different combinations that I try, I either get a "missing closing parameter" syntax error or "error: unable to execute program, the directory name is invalid." Runwait (@ComSpec & ' /c netsh interface ip set address "Local Area Connection" dhcp',"") ; one of the combinations I tried but got a syntax error.I want to run the command:netsh interface ip set address name="Local Area Connection" source=dhcp with@ComSpec... have tried just using "cmd/c" too but no luck.If I run the command by itself, without using the script and from the command line or start/run", than it works just fine.netsh command http://support.microsoft.com/?kbid=257748 Edited July 6, 2004 by autoitNOW An ADVOCATE for AutoIT Link to comment Share on other sites More sharing options...
SlimShady Posted July 6, 2004 Share Posted July 6, 2004 (edited) I looked for the syntax on my XP machine.And I found out that you can't use the keyword dhcp after "Local Area Connection".(Run the following to see what I mean: netsh interface ip ?)Only these are available:adddeletedumphelpresetsetshow Edited July 6, 2004 by SlimShady Link to comment Share on other sites More sharing options...
autoitNOW Posted July 6, 2004 Author Share Posted July 6, 2004 check netsh at microsoft and try the command... it exists... netsh interface ip set address name="Local Area Connection" dhcp An ADVOCATE for AutoIT Link to comment Share on other sites More sharing options...
emmanuel Posted July 6, 2004 Share Posted July 6, 2004 This worked fine for me. run(@comspec & ' /c netsh interface ip set address "Local Area Connection" dhcp',"") And so did this.run(@comspec & ' /c netsh interface ip set address "Local Area Connection" dhcp')I doublechecked by using /k instead of /c. And, just for shits and grins, I tried this, to get the successfull errorlevel of netsh:$err = RunWait(@comspec & ' /c netsh interface ip set address "Local Area Connection" dhcp') MsgBox(0,"netsh error level",$err & " = good") "I'm not even supposed to be here today!" -Dante (Hicks) Link to comment Share on other sites More sharing options...
autoitNOW Posted July 7, 2004 Author Share Posted July 7, 2004 (edited) aaarrghhhhh..... could have been me making a mistake with the syntax variations, via quotes... example- (@ComSpec & " /c " & 'commandName', "",).... as oppose to this variation- (@ComSpec & ' /c',"") which the syntax works also.... I have tried so many of them to see if any would work. But even though the syntax is correct, I still get "error: unable to execute program, the directory name is invalid." ...which, I don't understand why. Why would it say the directory name is invalid? Thanks guys Edited July 7, 2004 by autoitNOW An ADVOCATE for AutoIT Link to comment Share on other sites More sharing options...
autoitNOW Posted July 7, 2004 Author Share Posted July 7, 2004 (edited) Even tried %systemroot%\system32\netsh.exe... etc.... Why would it say the directory name is invalid? weird thing is I just modified the script to open start/run and that works fine everytime. Send("{CTRLDOWN}{ESC}{CTRLUP}") Send("r") WinWait("Run","") If Not WinActive("Run","") Then WinActivate("Run","") WinWaitActive("Run","") ...send netsh command.... Edited July 7, 2004 by autoitNOW An ADVOCATE for AutoIT Link to comment Share on other sites More sharing options...
SlimShady Posted July 7, 2004 Share Posted July 7, 2004 Can you try this again... Runwait (@ComSpec & ' /c netsh interface ip set address "Local Area Connection" dhcp', @SystemDir) 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