Batch File Still - TechRepublic
General discussion
February 16, 2006 at 08:28 AM
mbyrne3375

Batch File Still

by mbyrne3375 . Updated 20 years, 4 months ago

Was hoping someone could tell me how to do the following :-

FOR /F “tokens=1* delims=: ” %%A IN (‘SRVINFO -ns %1 ^| FIND “Domain:”‘) DO SET domain=%%B

The output of the above is domain.ad.co.uk

is there anyway in the batch file to make the variable ignore everything after the . so that any time a domain is found, it is only the first section that is delivered to the variable

E.G doma.ad.co.uk becomes doma
domb just remains domb
dombc.co.uk becomes dombc

Thanks in advance

This discussion is locked

All Comments