lunandi
Goto Top

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

Content-Key: 91386

Url: https://administrator.de/contentid/91386

Printed on: April 19, 2024 at 13:04 o'clock

Member: miniversum
miniversum Jul 06, 2008 at 17:29:08 (UTC)
Goto Top
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%"  
)
)