Search found 6 matches

by thudo
16 Feb 2022 21:35
Forum: DOS Batch Forum
Topic: Check which of many network domains the current machine is in then run a script
Replies: 8
Views: 9833

Re: Check which of many network domains the current machine is in then run a script

Update on this.. with further help I now have this which checks a txt file will all the fully qualified domain names and pipes it to a value %majordomain% The file domainlist.txt contains the following as an example: dev dev1.lab.mydevdomain1.net dev dev2.lab.mydevdomain2.net dev dev3.lab.mydevdomai...
by thudo
10 Feb 2022 23:10
Forum: DOS Batch Forum
Topic: Check which of many network domains the current machine is in then run a script
Replies: 8
Views: 9833

Re: Check which of many network domains the current machine is in then run a script

Thanks Squashman.. guess this batch logic needs to first find the correct name (skipping over other searches if needed) then, once done, skip over all to the end.
by thudo
10 Feb 2022 19:55
Forum: DOS Batch Forum
Topic: Check which of many network domains the current machine is in then run a script
Replies: 8
Views: 9833

Re: Check which network domain current machine is in

Update.. With some help I sort of have a semi-solution.. for %%s in (mydevdomain1.net mydevdomain2.net mydevdomain3.net) do if /i "%userdnsdomain:*.=%"=="%%s" goto DEV :DEV Echo "DEV Environment Found" for %%s in (myqadomain1.net myqadomain2.net myqadomain3.net) do if /i "%userdnsdomain:*.=%"=="%%s"...
by thudo
10 Feb 2022 13:55
Forum: DOS Batch Forum
Topic: Check which of many network domains the current machine is in then run a script
Replies: 8
Views: 9833

Re: Check which network domain current machine is in

You can not use an asterisk (or question-mark) as a "wild-card" for strings in Batch files. Perhaps this works? for /F "tokens=1,2 delims=_." %%a in ("%USERDNSDOMAIN%") do ( set "major=%%a" set "sub=%%b" ) set "sub=%sub:~-1%" echo %major% %sub% found if %major% == dev copy Xfile ... if %major% == q...
by thudo
10 Feb 2022 13:50
Forum: DOS Batch Forum
Topic: Check which of many network domains the current machine is in then run a script
Replies: 8
Views: 9833

Re: Check which network domain current machine is in

So, you want to get the substring after the underscore? for /f "tokens=2 delims=_" %%i in ("%%") do if "%%i"=="mydevdomain1.net" ... Yep so anything after the _ or . is what we need.. what comes before it could be anything actually using the DEV environment as example.. dev1_mydevdomain1.net dev2_m...
by thudo
10 Feb 2022 09:10
Forum: DOS Batch Forum
Topic: Check which of many network domains the current machine is in then run a script
Replies: 8
Views: 9833

Check which of many network domains the current machine is in then run a script

Morning everyone.. 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....