With the replace function we can replace any character we want, very simply. 8+ characters (letters, numbers, and a symbol). Cookies help us deliver our Services. This seems to work based on the ISE output: But if I use "Add-Content", "Out-File", or simply ">>" to write the variable out to the text file, it's written with single backslashes... How can I achieve the desired goal of having double backslashes as the output to this text file? You might want to post the code your using. Backslash isn't valid in a URL unless it's encoded. PowerShell is a cross-platform (Windows, Linux, and macOS) automation tool and configuration framework optimized for dealing with structured data (e.g. Case in point, my recent post about documenting your SCOM Distributed Applications, I found a test case where a user entered a backslash in the name of a Distributed Application. I’d recommend to treat an XML file not like plain text. I have tried to use the below (escape with backtick, as it seems to be the standard in powershell) and the variation of it by escaping the double quotes with the backslash (I’m basically a pure C programmer). Posted by: admin November 26, 2017 Leave a comment. This award recognizes a new member of Experts Exchange who has made outstanding contributions within their first year. Double backslash replace with single back slash and then convert into russian string. (Get your first solution completely free - no credit card required), This is called "escaping backslash" - writing double backslash instead of sungle backslash in the code, This is necessary exasctly because "\t", "\n" are special symbols, therefore when you want to show literal backslash you need to preced it with one more backslash, also doouble quote in Java program is a special symbol, because it signifies the, and of course very important case in many programs - when you want to, You don'yt need to force user to put double backslashes, So suppose in file.txt you have the first line, even if user ienters in the textfiield in the GUI of your program, You know what - lte me get part of my words back, This issue with loading properties is not the issue of reading backslsh form text file. Within a string "\\" represents a single backslash. This award recognizes someone who has achieved high tech and professional accomplishments as an expert in a specific topic. I've got a bunch of these that I've concatenated together: $var looks totally fine, it's formatted exactly how I need it at that moment. Sometimes when we automate things, some technologies don’t play nice with characters we’ve gotten from a different technology. The question is where I can read up on escaping in powershell or if somebody can explain why only the escaping the double quote with a double quote worked. Replace all backslashes in a string with double backslash (too old to reply) Daniel Guellmar 2005-10-26 17:40:58 UTC. string url = "http://www.google.com/search?q=20%5C20";HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(url);WebResponse response = req.GetResponse();string text = new StreamReader(response.GetResponseStream()).ReadToEnd();Console.WriteLine(text);When I put a break point over the WebResponse line, and checked the req.RequestUri, it was:http://www.google.com/search?q=20\20With a backslash.