I have one powershell command inside that both Double quotes and single quotes are present and it's needed for sure in order to make the command execute successfully in dos prompt. I am not sure how to make it escape in pipeline script.
bat "powershell -Command "(Get-Content "${Physical_FolderLoc}\\${Stord_Process_Name}.txt") | ForEach-Object { $_ -replace [RegEx]::Escape('E:\\config'), 'I:\\config' } | Set-Content "${Physical_FolderLoc}\\${Stord_Process_Name}.txt" " "
In the above command you can see the second last " is ending quote for Get Content and last one is for bat command. I tried the above command with triple slash but getting groovy error.
groovy.lang.MissingPropertyException: No such property: _ for class: groovy.lang.Binding
at groovy.lang.Binding.getVariable(Binding.java:63)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty
Please help me to resolve this.