Quantcast
Viewing latest article 11
Browse Latest Browse All 180

PowerShell Syntax Highlighting

I mainly answer PHP questions where syntax highlighting has always worked for me with just indentation. I've just started using PowerShell and have asked a couple of questions and syntax highlighting seems to be wonky:

. "$PSScriptRoot\third.ps1"#get $Current  = second.ps1#get $Caller   = first.ps1 #get $Original = first.ps1$wc = new-object System.Net.WebClient$wc.Headers.Add("user-agent", "PowerShell Script")$wc.Proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials$action = [System.IO.Path]::GetFileNameWithoutExtension($myInvocation.MyCommand.Name)

Wouldn't even some default syntax highlighting get one of the most common comment # styles right?

mklement0 states in Get original script name included script name and possibly others that using ```sh is a hack to get it to work:

    . "$PSScriptRoot\third.ps1"    #get $Current  = second.ps1    #get $Caller   = first.ps1     #get $Original = first.ps1    $wc = new-object System.Net.WebClient    $wc.Headers.Add("user-agent", "PowerShell Script")    $wc.Proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials    $action = [System.IO.Path]::GetFileNameWithoutExtension($myInvocation.MyCommand.Name)

Viewing latest article 11
Browse Latest Browse All 180

Trending Articles