Jump to content

Recommended Posts

Posted (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 by autoitNOW
An ADVOCATE for AutoIT
Posted (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:

add

delete

dump

help

reset

set

show

Edited by SlimShady
Posted

check netsh at microsoft and try the command... it exists... netsh interface ip set address name="Local Area Connection" dhcp

An ADVOCATE for AutoIT
Posted

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)

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

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
×
×
  • Create New...