batch file - .bat - insert text before a period -
i have .bat use query basic information servers. after gets fqdn dns, need insert "-r" (minus quotes) after servername, before ".domain.com". area added script below -
for /f "delims=[] tokens=2" %%b in ('ping %servername% -n 1 ^| findstr "["') (set thisip=%%b) /f "tokens=2" %%a in ('nslookup %thisip% ^| find /i "name: "') (set fqdnstat=%%a)
so how can take fqdn, set fqdnstat, , modify - server.domain.com server-r.domain.com ?
edit - guess didn't explain well. need insert text line of text, before period. need take following name: server.domain.com , edit read server-r.domain.com, using command. rest of script above context issue. fqdnstat variable use qualified domain name.
i afraid don't understand concern, batch file may you:
@echo off set fqdnstat=server.domain.com echo before: "%fqdnstat%" /f "tokens=1* delims=." %%a in ("%fqdnstat%") set "fqdnstat=%%a-r.%%b" echo after: "%fqdnstat%"
Comments
Post a Comment