I want to use a Windows path. But any time I save a Windows Path to a usual UiPath variable, it is always replaced by a double quote.
For example: "C:\some\path\to\a\file.txt"
is replaced by "C:\\some\\path\\to\\a\\file.txt"
In usual VB.net it is not changed in that way. I also tried to use the replace activity. But after replacing "\\" with "\" it always replaces it with double backslashes. I’m confused about that behaviour. Is this anything good for a simply a bug?
By the way. When I use Strings directly without saving to a variable it also works. So let’s say I have a variable with the value: "C:\\some\\path\\to\\a\\file.txt" and I use it directly in an activity via "C:\\some\\path\\to\\a\\file.txt".ToString.Replace("\\","\") it works. But in my case I need it directly in the variable.
I think it’s just a visual issue. Somehow now when I try to access the folder or create a new one with the double quoted String, it works. Maybe I had a mistake in my process.
Anyway why is a backslash always doubled? It seems that internally a signle backslash is used.
Anyway I just ignore the double backslash now and continue as if it’s a single one.
By the way. The background is that I save config to a json file. And there you cannot save single backslashes in. So I escape them there with another backslash. And in UiPath I tried to clean that Path. But as already said it’s somehow just a visual bug of UiPath. It works with double slashes.
Steps to reproduce:
create String variable with "C:\test\path"
Debug with Step into and see that it’s set to "C:\\test\\path" in the locals
Hi @kwoxer,
Sorry for very very late response. I finally got answer to this.
So it is expected behavior in case of String type variables. The double backslash is escape character (first ) + the actual character (second ).