escape sequence, string literals, c#
I have a string variable that is hooked up to a textBox. the user will be
writing powershell queries in this textbox and i need to run the command.
BUT... dumm dumm dummmmm... when ever the user (in this case me) types in
something like Get-WMIObject Win32_LogicalDisk -filter ""DriveType=3"" |
Select
SystemName,DeviceID,VolumeName,@{Name="size(GB)";Expression={"{0:N1}"-f($_.size/1gb)}},@{Name="freespace
GB)";Expression={"{0:N1}" -f($_.freespace/1gb)}} the compiler sees escape
sequences at the '"'
Question
Is there a way to not have the compiler recognize the escape sequences? I
know doing that creating a verbatim string literal is the usual way to go.
But can I do this at runtime?
-I know this is pretty basic stuff, apparently i skipped a chapter somewhere?
No comments:
Post a Comment