I have a string as follows, although it throws an error when it gets to the colon, I have used @ to escape everything:
string vmListCommand = @"vim-cmd vmsvc/getallvms | sed '1d' | awk '{if ($1 > 0) print $1":"$2}'";
I have a string as follows, although it throws an error when it gets to the colon, I have used @ to escape everything:
string vmListCommand = @"vim-cmd vmsvc/getallvms | sed '1d' | awk '{if ($1 > 0) print $1":"$2}'";
 
    
    Remove @ and escape double quotes using \:
string vmListCommand = "vim-cmd vmsvc/getallvms | sed '1d' | awk '{if ($1 > 0) print $1\":\"$2}'";
You wrote:
I have used @ to escape everything
@ is used to change escaping bahaviour, not to escape everything. If a string is prefixed with @ then escape sequences (\) are ignored.
 
    
    You need to remove the literal and escape
string vmListCommand = "vim-cmd vmsvc/getallvms | sed '1d' | awk '{if ($1 > 0) print $1\":\"$2}'";
 
    
    There is one character that needs to be escaped in literal strings. The double quote ". If you don't escape it, how would the compiler know which " are part of the string, and which terminate the string?
To escape a " in a literal string, simply double it:
 @"vim-cmd vmsvc/getallvms | sed '1d' | awk '{if ($1 > 0) print $1"":""$2}'"
Alternatively you could switch to the normal string syntax, and escape with \.
