Powershell Best Practice #13: Avoid double quotes in strings if not necessary

By | June 28, 2015

Best Practice: It is recommended to avoid double quotes if there are no variables or escape sequences in strings, prefer single quotes.

Single quotes (literal string)

Double quotes (expanding string)

Explanation: Single quotes disable the expansion of variables and should be preferred if there is no variable or escape sequence inside strings.


previous-buttonnext-button

One thought on “Powershell Best Practice #13: Avoid double quotes in strings if not necessary

  1. Pingback: Powershell Best Practice #12: Avoid Out-Null | Powershell Guru

Leave a Reply

Your email address will not be published. Required fields are marked *