Page 1 sur 1

[..] Configuration IP

Posté : lun. 21 déc. 2009 09:46
par serr57
hello,

Voilà je voudrais que certains utilisateurs puisse changer leur IP en fonction de leur situation géographique, mais je n'arrive pas à voir où cela "peche". dans le code là

Code : Tout sélectionner

;Network Interface Renaming
Run(@ComSpec & " /c " & 'netsh interface set interface name="' & "Local Area Connection" &'" newname="name"', "", @SW_HIDE)

;new Interface name to Set
$eth0 = "name"

;New network Parameters Entry
$ip = InputBox("", "Enter IP")
$sub = InputBox("", "Enter Subnet")
$gw = InputBox("", "Enter Gateway")
$DNS1 = InputBox("", "Enter DNS 1")
$DNS2 = InputBox("", "Enter DNS 2")

SplashTextOn("STATIC IP Configuration","STATIC IP Configuration is on going ...", 400, 50, -1, -1, 33, -1, 18)
Sleep(3000)

; New static IP settings.
RunWait(@ComSpec & " /c " & 'netsh interface ip set address name="' & '"' & $eth0 & '"' & $ip, $sub, $gw, "", @SW_HIDE)
; New static DNS settings
RunWait(@ComSpec & " /c " & 'netsh interface ip set dns name=' & '"' & $eth0 & '"' & $DNS1, "", @SW_HIDE)
RunWait(@ComSpec & " /c " & 'netsh interface ip add dns name=' & '"' & $eth0 & '"' & $DNS2, "", @SW_HIDE)


SplashTextOn("STATIC IP Configuration","STATIC IP Configuration is finished.", 400, 50, -1, -1, 33, -1, 18)
Sleep(3000)
SplashOff()
 
error:

C:\IP.au3 (29) : ==> Incorrect number of parameters in function call.:
RunWait(@ComSpec & " /c " & 'netsh interface ip set address name="' & '"' & $eth0 & '"' & $ip, $sub, $gw, "", @SW_HIDE)
^ ERROR

Si quelqu'un pouvait m'aiguiller

Merci d'avance

serr57

Re: [..] Configuration IP

Posté : lun. 21 déc. 2009 11:24
par Tlem