ich habe ein Problem mit einer PatchHosts-Sektion, die mir nicht richtig abgearbeitet wird (siehe Log weiter unten). Es soll ein Host mit einer bestimmten IP in der hosts-Datei von Windows 7-x64 eingetragen werden. Zuvor sollen etwaige Einträge mit der gleichen IP und/oder dem gleichen Hostnamen entfernt werden. Leider funktioniert die ganze Geschichte nur beim ersten Mal. Ich habe schon mehrere Dinge ausprobiert, u. a. den Namen der hosts-Datei mit übergeben, eine Pause einbauen, usw. Es funktioniert einfach nicht.
Auszug aus der .ins-Datei:
Code: Alles auswählen
Set $EtcHosts$ = "%System%\drivers\etc\hosts"
PatchHosts_testhost_delete $EtcHosts$
sleepSeconds 1
PatchHosts_testhost $EtcHosts$
[PatchHosts_testhost_delete]
delhost testhost.mydomain.lan
delhost testhost
delhost 10.1.2.3
[PatchHosts_testhost]
setname 10.1.2.3 testhost.mydomain.lan
setalias 10.1.2.3 testhost
Code: Alles auswählen
Execution of PatchHosts_testhost_delete
FILE C:\Windows\system32\drivers\etc\hosts
Entry "testhost.mydomain.lan" deleted
Info: Host "testhost" not found
Info: Host "10.1.2.3" not found
Warning: C:\Windows\system32\drivers\etc\hosts could not be saved back - will retry, error message: "Unable to create file "C:\Windows\system32\drivers\etc\hosts""
Warning: C:\Windows\system32\drivers\etc\hosts could not be saved back - will retry, error message: "Unable to create file "C:\Windows\system32\drivers\etc\hosts""
Warning: C:\Windows\system32\drivers\etc\hosts could not be saved back - will retry, error message: "Unable to create file "C:\Windows\system32\drivers\etc\hosts""
Warning: C:\Windows\system32\drivers\etc\hosts could not be saved back - will retry, error message: "Unable to create file "C:\Windows\system32\drivers\etc\hosts""
Error: C:\Windows\system32\drivers\etc\hosts could not be saved back - will not retry, error message: "Unable to create file "C:\Windows\system32\drivers\etc\hosts""
Gruß
kinzi