IT-Sheriff
IT-Sheriff

Reputation: 164

How to skip double quotes in Ruby

I have following command:

    exec 'powershell.exe -ExecutionPolicy RemoteSigned -Command  & "{[Environment]::SetEnvironmentVariable("JAVA_HOME", "C:\ProgramFiles\Java\jre1.8.0_60\bin", "Machine");$env:JAVA_HOME}"'

It's not working because the external double quote is getting closed by another double quote. How do I resolve this problem?

Upvotes: 0

Views: 172

Answers (1)

sawa
sawa

Reputation: 168071

If you want a string fragment that would be interpreted as an escaped double quote, then you need to escape the escape character: \\".

Upvotes: 1

Related Questions