General question about batch\ help files

Jay Thomas
Jay Thomas used Ask the Experts™
on
Hi all, when ever I'm looking a batch file to do something or details on how to run dsquery for example I'm always greeted with something that looks like this:

dsquery user [{<StartNode> | forestroot | domainroot}] [-o {dn | rdn | upn | samid}] [-scope {subtree | onelevel | base}] [-name <Name>] [-desc <Description>] [-upn <UPN>] [-samid <SAMName>] [-inactive <NumberOfWeeks>] [-stalepwd <NumberOfDays>] [-disabled] [{-s <Server> | -d <Domain>}] [-u <UserName>] [-p {<Password> | *}] [-q] [-r] [-gc] [-limit <NumberOfObjects>] [{-uc | -uco | -uci}]

Here's my question. I'm not asking about dsquery just asking about what some of teh syntax means above.
1. The top line starts with a [ followed by {  and then some stuff witch a couple of pipe commands and the ends with a } followed by ]. What is this telling me, to use the brackets not to use them i really have no idea? As you look down the example you will see more of them. "2nd, i often see reference to stuff inside <> as above, what's that about. If anyone can give me a break down of the above (not what dsquery does) just what all the brackets and stuff mean I'd really appreciate it.
Thanks for looking
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2013
Commented:
That syntax is supposed to make it easier to follow

for example   [-inactive <NumberOfWeeks>]

-inactive is an option then you put the number of weeks (without the <>)

dsquery computer -inactive 4

It can definitely be confusing but the more you use it the easier it will be.  Look at examples online and here at EE

http://social.technet.microsoft.com/wiki/contents/articles/2195.dsquery-commands-en-us.aspx

examples are always a good starting place for me

Thanks

Mike
Commented:
Anything surrounded by <...> is a variable -- put your specific info here

Anything surrounded by {...} means pick one.   The | separates choces.

Square brackets [...] are sectional breaks and show options
Leon FesterSenior Solutions Architect
Commented:
The square brackets [ & ] denotes that start and end of a parameter
The curly brackets { & } denotes the list of values that can be passed to that parameter
The pipe command | is used to seperate the values that can be used.

e.g.
 [-o {dn | rdn | upn | samid}]
You can use the parameter -o and you need to specify a value of either dn | rdn | upn | samid

Check in some of the more formal Microsoft documentation. e.g. white papers.
They usually define the naming conventions and standards used in the documenation.
Vipin VasudevanInfrastructure Specialist
Commented:
Hope below example will give you more idea on this

dsquery user -startnode DomainRoot -scope subtree -name John*  >>>>  for a user named after John in his CN with is a domain and search on all sub container with in the domain

dsquery user -startnode "ou=sales,dc=dom,dc=com" -scope Onelevel -name John*  >>>>  for a user named after John in his CN with in sales OU and search only one level on sales ou

Author

Commented:
Many thanks to all. This has helped me out.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial