cmd shell syntax

D

ds215588

Hi,

Can anybody give me a link on the internet with a legend to the syntax
used in windows cmd commands?

e.g. in the example below what dows [ x | y ] or { x | y } mean?

Is there a legend with all symbols somewhere?

Thanks, Dani


NET USE
[devicename | *] [\\computername\sharename[\volume] [password | *]]
[/USER:[domainname\]username]
[/USER:[dotted domain name\]username]
[/USER:[username@dotted domain name]
[/SMARTCARD]
[/SAVECRED]
[[/DELETE] | [/PERSISTENT:{YES | NO}]]
 
M

Mark Weinreb

Hi,

Can anybody give me a link on the internet with a legend to the syntax
used in windows cmd commands?

e.g. in the example below what dows [ x | y ] or { x | y } mean?

Is there a legend with all symbols somewhere?

Thanks, Dani


NET USE
[devicename | *] [\\computername\sharename[\volume] [password | *]]
[/USER:[domainname\]username]
[/USER:[dotted domain name\]username]
[/USER:[username@dotted domain name]
[/SMARTCARD]
[/SAVECRED]
[[/DELETE] | [/PERSISTENT:{YES | NO}]]

Anything between [ and ] is optional, the vertical line | is a choice,
anything between { and } is required.
So [ x | y ] means you can have x, y or neither but not both. { x | y }
means either x or y, but you must choose one.

In your real-world example above,
"NET USE" is valid as everthing else is in [ ] pairs (it won't do anything
much in this example).
"NET USE" devicename is also valid assuming you use a valid devicename.
"NET USE *" is also valid, because * is a wildcard meaning all devicenames.
"NET USE devicename *" is not valid - only one option allowed.
If you want to use the /PERSISTENT parameter, the only valid syntax is
/PERSISTENT:YES or /PERSISTENT:NO

The quotes in the above lines are mearly there to seperate the commands from
by comments.

I learnt the meaning of the metadata symbols [ ] | { } from a COBOL68 manual
back in '69. ANy decent programming manual which includes syntax diagrams
should explain the symbols.
 
D

ds215588

thanks a lot Mark!

\Dani


Mark Weinreb said:
Hi,

Can anybody give me a link on the internet with a legend to the syntax
used in windows cmd commands?

e.g. in the example below what dows [ x | y ] or { x | y } mean?

Is there a legend with all symbols somewhere?

Thanks, Dani


NET USE
[devicename | *] [\\computername\sharename[\volume] [password | *]]
[/USER:[domainname\]username]
[/USER:[dotted domain name\]username]
[/USER:[username@dotted domain name]
[/SMARTCARD]
[/SAVECRED]
[[/DELETE] | [/PERSISTENT:{YES | NO}]]

Anything between [ and ] is optional, the vertical line | is a choice,
anything between { and } is required.
So [ x | y ] means you can have x, y or neither but not both. { x | y }
means either x or y, but you must choose one.

In your real-world example above,
"NET USE" is valid as everthing else is in [ ] pairs (it won't do anything
much in this example).
"NET USE" devicename is also valid assuming you use a valid devicename.
"NET USE *" is also valid, because * is a wildcard meaning all devicenames.
"NET USE devicename *" is not valid - only one option allowed.
If you want to use the /PERSISTENT parameter, the only valid syntax is
/PERSISTENT:YES or /PERSISTENT:NO

The quotes in the above lines are mearly there to seperate the commands from
by comments.

I learnt the meaning of the metadata symbols [ ] | { } from a COBOL68 manual
back in '69. ANy decent programming manual which includes syntax diagrams
should explain the symbols.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top