Skip to main content
OK, bumped. But this answer is a candidate for a canonical reference (incl. recent ones) about PowerShell highligting. [<https://en.wikipedia.org/wiki/Windows_PowerShell> <https://en.wikipedia.org/wiki/Visual_Studio_Code> <stackoverflow.com/legal/trademark-guidance> (the last section)].
Source Link

PowershellPowerShell and batch syntax highlighting is off all around and neither works correctly
   (left: StackExchange ;Stack Exchange; right: Microsoft's VS CodeVisual Studio Code)
   Screenshot1

  • It appears batch and PowershellPowerShell syntax have been linked to each other, which simply doesn't work for either due to the different ways variables and other characters are used between the two:
    • PowershellPowerShell comments use #, whereas batch uses ::
         Screenshot 2
    • PowershellPowerShell variables use $, whereas batch uses %<variable>%
      Screenshot3
    • PowershellPowerShell doesn't support linking commands via &||&&, using ; instead, which batch doesn't support

       
  • PowershellPowerShell syntax only syntax highlights if first letter of command or parameter is capitalized, leading to a ridiculous amount of posts not syntax highlighted unless edited, as it doesn't syntax highlight if the entire command/parameter is in all lowercase or all uppercase (latter also affecting batch), which it should since PowershellPowerShell isn't case aware
    • PowershellPowerShell and batch syntax highlights don't apply as they should when code fences are used (also an issue with other languages), regardless whether the syntax is specified after the code fence or not - the only way to reliably have it syntax highlighted is to use HTML syntax comment <!-- language-all: lang-powershell --> or lang-bat (wassit was also an issue with Prettify)

Powershell and batch syntax highlighting is off all around and neither works correctly
 (left: StackExchange ; right: Microsoft's VS Code)
 Screenshot1

  • It appears batch and Powershell syntax have been linked to each other, which simply doesn't work for either due to the different ways variables and other characters are used between the two:
    • Powershell comments use #, whereas batch uses ::
       Screenshot 2
    • Powershell variables use $, whereas batch uses %<variable>%
      Screenshot3
    • Powershell doesn't support linking commands via &||&&, using ; instead, which batch doesn't support

       
  • Powershell syntax only syntax highlights if first letter of command or parameter is capitalized, leading to a ridiculous amount of posts not syntax highlighted unless edited, as it doesn't syntax highlight if the entire command/parameter is in all lowercase or all uppercase (latter also affecting batch), which it should since Powershell isn't case aware
    • Powershell and batch syntax highlights don't apply as they should when code fences are used (also an issue with other languages), regardless whether the syntax is specified after the code fence or not - the only way to reliably have it syntax highlighted is to use HTML syntax comment <!-- language-all: lang-powershell --> or lang-bat (wass also an issue with Prettify)

PowerShell and batch syntax highlighting is off all around and neither works correctly   (left: Stack Exchange; right: Microsoft's Visual Studio Code)   Screenshot1

  • It appears batch and PowerShell syntax have been linked to each other, which simply doesn't work for either due to the different ways variables and other characters are used between the two:
    • PowerShell comments use #, whereas batch uses ::   Screenshot 2
    • PowerShell variables use $, whereas batch uses %<variable>%
      Screenshot3
    • PowerShell doesn't support linking commands via &||&&, using ; instead, which batch doesn't support
  • PowerShell syntax only syntax highlights if first letter of command or parameter is capitalized, leading to a ridiculous amount of posts not syntax highlighted unless edited, as it doesn't syntax highlight if the entire command/parameter is in all lowercase or all uppercase (latter also affecting batch), which it should since PowerShell isn't case aware
    • PowerShell and batch syntax highlights don't apply as they should when code fences are used (also an issue with other languages), regardless whether the syntax is specified after the code fence or not - the only way to reliably have it syntax highlighted is to use HTML syntax comment <!-- language-all: lang-powershell --> or lang-bat (it was also an issue with Prettify)
Mod Moved Comments To Chat
added 25 characters in body
Source Link

Powershell and batch syntax highlighting is off all around and neither works correctly
(left: StackExchange ; right: Microsoft's VS Code)
Screenshot1

  • It appears batch and Powershell syntax have been linked to each other, which simply doesn't work for either due to the different ways variables and other characters are used between the two:
    • Powershell comments use #, whereas batch uses ::
      Screenshot 2
    • Powershell variables use $, whereas batch uses %<variable>%
      Screenshot3
    • Powershell doesn't support linking commands via &||&&, using ; instead, which batch doesn't support

  • Powershell syntax only syntax highlights if first letter of command or parameter is capitalized, leading to a ridiculous amount of posts not syntax highlighted unless edited, as it doesn't syntax highlight if the entire command/parameter is in all lowercase or all uppercase (latter also affecting batch), which it should since Powershell isn't case aware
    • Powershell and batch syntax highlights don't apply as they should when code fences are used (also an issue with other languages), regardless whether the syntax is specified after the code fence or not - the only way to reliably have it syntax highlighted is to use HTML syntax comment <!-- language-all: lang-powershell --> or lang-bat (wass also an issue with Prettify)

Powershell and batch syntax highlighting is off all around and neither works correctly
(left: StackExchange ; right: Microsoft's VS Code)
Screenshot1

  • It appears batch and Powershell syntax have been linked to each other, which simply doesn't work for either due to the different ways variables and other characters are used between the two:
    • Powershell comments use #, whereas batch uses ::
      Screenshot 2
    • Powershell variables use $, whereas batch uses %<variable>%
      Screenshot3
    • Powershell doesn't support linking commands via &||&&, using ; instead, which batch doesn't support

  • Powershell syntax only syntax highlights if first letter of command or parameter is capitalized, leading to a ridiculous amount of posts not syntax highlighted unless edited, as it doesn't syntax highlight if the entire command/parameter is in all lowercase or all uppercase (latter also affecting batch), which it should since Powershell isn't case aware
    • Powershell and batch syntax highlights don't apply as they should when code fences are used (also an issue with other languages), regardless whether the syntax is specified after the code fence or not - the only way to reliably have it syntax highlighted is to use HTML syntax comment <!-- language-all: lang-powershell --> or lang-bat (wass also an issue with Prettify)

Powershell and batch syntax highlighting is off all around and neither works correctly
(left: StackExchange ; right: Microsoft's VS Code)
Screenshot1

  • It appears batch and Powershell syntax have been linked to each other, which simply doesn't work for either due to the different ways variables and other characters are used between the two:
    • Powershell comments use #, whereas batch uses ::
      Screenshot 2
    • Powershell variables use $, whereas batch uses %<variable>%
      Screenshot3
    • Powershell doesn't support linking commands via &||&&, using ; instead, which batch doesn't support

  • Powershell syntax only syntax highlights if first letter of command or parameter is capitalized, leading to a ridiculous amount of posts not syntax highlighted unless edited, as it doesn't syntax highlight if the entire command/parameter is in all lowercase or all uppercase (latter also affecting batch), which it should since Powershell isn't case aware
    • Powershell and batch syntax highlights don't apply as they should when code fences are used (also an issue with other languages), regardless whether the syntax is specified after the code fence or not - the only way to reliably have it syntax highlighted is to use HTML syntax comment <!-- language-all: lang-powershell --> or lang-bat (wass also an issue with Prettify)
Source Link
JW0914
  • 258
  • 1
  • 6

Powershell and batch syntax highlighting is off all around and neither works correctly
(left: StackExchange ; right: Microsoft's VS Code)
Screenshot1

  • It appears batch and Powershell syntax have been linked to each other, which simply doesn't work for either due to the different ways variables and other characters are used between the two:
    • Powershell comments use #, whereas batch uses ::
      Screenshot 2
    • Powershell variables use $, whereas batch uses %<variable>%
      Screenshot3
    • Powershell doesn't support linking commands via &||&&, using ; instead, which batch doesn't support

  • Powershell syntax only syntax highlights if first letter of command or parameter is capitalized, leading to a ridiculous amount of posts not syntax highlighted unless edited, as it doesn't syntax highlight if the entire command/parameter is in all lowercase or all uppercase (latter also affecting batch), which it should since Powershell isn't case aware
    • Powershell and batch syntax highlights don't apply as they should when code fences are used (also an issue with other languages), regardless whether the syntax is specified after the code fence or not - the only way to reliably have it syntax highlighted is to use HTML syntax comment <!-- language-all: lang-powershell --> or lang-bat (wass also an issue with Prettify)