() and books on cmd

Welcome Forums General PowerShell Q&A () and books on cmd

This topic contains 2 replies, has 2 voices, and was last updated by

4 years, 4 months ago.

  • Author
  • #19847

    Points: 1
    Rank: Member


    I have two questions. I know the $() is documented as a subexpression, but what about the double parenthesis without the $ ? I can't find its documentation in the about_operators page.
    Also I know this is a stupid question, but there are dozens of books on powershell. Are there any on cmd itself. I know that powershell basically abrogates cmd, but I can't believe all those years there was not a book you could pick up to learn the windows command line.

  • #19848

    Points: 0
    Rank: Member

    There are a couple of differences between $() and ():

    • The subexpression operator $() can contain any number of statements. The expression inside parentheses () can only be a single pipeline
    • $() can be used to embed expression inside a double-quoted string; parentheses are just treated as literal characters in that context.

    You'll mostly see $() used in the second case, to embed the result of some expression within a string, without the need for a temporary variable. Parentheses are mostly used either for changing the order of operations in an expression (causing the contents of the parentheses to be evaluated first), or to force PowerShell into expression parsing mode instead of argument parsing mode. (This is covered in the about_Parsing help file.)

  • #19849

    Points: 0
    Rank: Member

    As far as learning the old command prompt goes, a lot of that knowledge will depend on console applications (each with their own help files and syntax.) However, for the shell itself, I've always found this site to be a good reference: http://www.robvanderwoude.com/batchfiles.php

The topic ‘() and books on cmd’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort