How to replace single backslash in windows path to double backslashes $path="c:\abc\xyz" == > "c:\\abc\\xyz" I tried ~s/\\/\\\\/g but it didn't work Thanks for help