Domains (per DNSCMD) aus einer Liste eintragen
Hallo Administrator.de Community,
ich hoffe ihr könnt mir weiter helfen. Ich habe mehrere Text Dateien (.txt) in denen mehrere Domains eingetragen sind. Pro Zeile ist immer eine Domain.
[quote]
domain1.de
domain2.de
domain3.de
domain4.de
dom...
[/quote]
Ich will nun das das diese domains automatisch in eine variable aus einer Batchdatei eingefügt werden. Hier:
[quote]
dnscmd . /ZoneAdd %domain_var% /Primary /file %domain_var%.dns
Dnscmd . /RecordAdd %domain_var% @ SOA "" a SOA "" a@a.a 0 3600 600 86400 3600
Dnscmd . /RecordAdd %domain_var% * A 192.168.1.100
Dnscmd . /RecordAdd %domain_var% www A 192.168.1.100
[/quote]
So das am Ende eine größere Batch Datei entsteht die dann alle "dnscmds" beinhaltet um sie einfach dem DNS Server auszuführen.
Danke
ich hoffe ihr könnt mir weiter helfen. Ich habe mehrere Text Dateien (.txt) in denen mehrere Domains eingetragen sind. Pro Zeile ist immer eine Domain.
[quote]
domain1.de
domain2.de
domain3.de
domain4.de
dom...
[/quote]
Ich will nun das das diese domains automatisch in eine variable aus einer Batchdatei eingefügt werden. Hier:
[quote]
dnscmd . /ZoneAdd %domain_var% /Primary /file %domain_var%.dns
Dnscmd . /RecordAdd %domain_var% @ SOA "" a SOA "" a@a.a 0 3600 600 86400 3600
Dnscmd . /RecordAdd %domain_var% * A 192.168.1.100
Dnscmd . /RecordAdd %domain_var% www A 192.168.1.100
[/quote]
So das am Ende eine größere Batch Datei entsteht die dann alle "dnscmds" beinhaltet um sie einfach dem DNS Server auszuführen.
Danke
Please also mark the comments that contributed to the solution of the article
Content-Key: 91386
Url: https://administrator.de/contentid/91386
Printed on: April 27, 2024 at 00:04 o'clock
1 Comment
Versuchs mal damit:
@echo off
set "outbat=Liste.bat"
FOR /F "delims=" %%f in ('dir /b /a-d "C:\Dateien\*.txt"') do (
FOR /F "delims=" %%d in (echo %%f) do @echo %i
(
dnscmd . /ZoneAdd %%d /Primary /file %%d.dns>>"%outbat%"
Dnscmd . /RecordAdd %%d @ SOA "" a SOA "" a@a.a 0 3600 600 86400 3600>>"%outbat%"
Dnscmd . /RecordAdd %%d * A 192.168.1.100>>"%outbat%"
Dnscmd . /RecordAdd %%d www A 192.168.1.100>>"%outbat%"
)
)