Invoke powershell quote mark problem

Hi Everyone,

I am trying to invoke a powershell code in studio but I can’t set the quotation marks proparly. I have changed most of the " to ’ but this one doesn’t work. I also tried to use slash but couldn’t use it properly. Can you please help? Thank you.

@dcrt - have you tried with single quotes instead of double?

I did and it did work for the rest of the project but it doesn’t work with the marked one

try to use “”\$Server\c$“”

I still get a syntax error unfortunately :frowning:

Unfortunately, double quotes in a multi line string simply doesn’t work in the Expression Editor.

This is OK:

"The server is ""\Server\c"""

This is not OK:

"The
server
is
""\Server\c"""

The workaround is to use single line strings instead and combine them with Environment.NewLine.

"The" + Environment.NewLine +
"server" + Environment.NewLine +
"is" + Environment.NewLine +
"""\Server\c"""

This works fine for a few lines but becomes unmanageable if there are more.

May I ask why you don’t put the script in a file and invoke the file instead?

2 Likes

That’s what I had to do eventually, Thank you so much for your time and reply :slight_smile:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.