I just can't get it right
The below statement throws an exception and I cannot get the correct format
$appendedQry = $appendedQry -replace "\"","'" What would be the correct syntax?
It should be
$appendedQry = $appendedQry -replace '"','''' -replace '"',"'". ;)I was replacing all occurances of the string in a file, using command
powershell -Command "(gc c:\input.txt) -replace 'aaa', 'bbb' | Out-File c:\output.txt" To replace double quotes I need to do some trick - use the variable:
$ToReplace = "\" + """" $command = "(gc c:\input.txt) -replace '" + $ToReplace + "', 'bbb' | Out-File c:\output.txt" powershell -Command $command