Jump to content

@ComSpec versus "Local Area Connection"


Recommended Posts

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 by autoitNOW
An ADVOCATE for AutoIT
Link to comment
Share on other sites

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:

add

delete

dump

help

reset

set

show

Edited by SlimShady
Link to comment
Share on other sites

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

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 by autoitNOW
An ADVOCATE for AutoIT
Link to comment
Share on other sites

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 by autoitNOW
An ADVOCATE for AutoIT
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...