Trying to script the following in DOS BATCH but its not turning out as I wished.
In our network we have three major domains, DEV, QA, and PRD and for each we also have sub-domains in all three so an example:
DEV
dev.mydevdomain1.net
dev.mydevdomain2.net
dev.mydevdomain3.net
QA
qa.myqadomain1.net
qa.myqadomain2.net
qa.myqadomain3.net
PRD
prd.myprddomain1.net
prd.myprddomain2.net
prd.myprddomain3.net
What we want to do is first determine the network domain which the current machine where the dos batch script is current on so using the env variable %USERDNSDOMAIN% I get:
dev.mydevdomain1.net
So I figured I could do the following using a wildcard but its not working as expected:
Code: Select all
IF %USERDNSDOMAIN% == *.mydevdomain1.net (echo "DEV 1 FOUND") ELSE IF %USERDNSDOMAIN% == *.mydevdomain2.net (echo "DEV 2 FOUND") ELSE IF %USERDNSDOMAIN% == *.mydevdomain3.net (echo "DEV 3 FOUND") ELSE (echo "DEV NOT FOUND)
If current machine is in either *.mydevdomain1.net, *.mydevdomain2.net, *.mydevdomain3.net OR *.myqadomain1.net, *.myqadomain2.net, *.myqadomain3.net THEN copy X file ELSE IF machine is in *.myprddomain1.net, *.myprddomain2.net, *.myprddomain3.net THEN copy Y file.
Note the wildcards where they are.. that is somewhat important.
Any help would be most appreciated. Thank you community!