Asked — Edited
Resolved Resolved by Rich!

Is There An Sequence To Escape / When Using In A String For Path Vars?


This is ok $BasePath = "G:"

but this gives error

$BasePath = "G:/"

it is because of the / , im asuming is being used as an escape char in Ez-Script.

is there a way to escape this?


Upgrade to ARC Pro

Unleash your robot's full potential with the cutting-edge features and intuitive programming offered by Synthiam ARC Pro.


I don't get an error when I run a script with your example in it ... $BasePath = "G:/" .... Do you have the full script to post?

United Kingdom

Two things;

  1. Shouldn't it be "G:"?
  2. "G:" does give an error. However "G:\EZ-Builder" is OK.

What is this for? It may be that there is a better/different way of doing it.


yes sorry it is the " that give the error

I can code around it. Being familiar with many languages but not so familiar with EZ-Script , most languages have and escape code around this for instand !" would work in some languages or \" to produce single back slash

United Kingdom

If you add a trailing space it will save the variable however that will lead to problems with any commands that use the variable.

Again, what's it for? That may help find a solution. I assume some kind of file interaction but would need to know more.

If the intention is to have a path and multiple different $file variables you can always use $basepath as "G:" and have the $file variables (or text) begin with the \


$basepath = "G:"
$filename = "\log.txt"
FileWrite($basepath+$filename, "Here is some data")

That is the work around i am currently using Rich. I was just wanting to avoid putting the \ in front of all the file names when i could have had it once in the base path decoration.

This is they script and its use.

Print("Setting up Variables") $BasePath = "G:" $OutputDir = $BasePath + "\DataOut" $InputDir = $BasePath + "\DataIn" $Weatherinput = $InputDir + "\wather.rss" $X10SystemInput = $InputDir + "\HomeX10.rss" $TaskListInput = $inputDir + "\Tasklist.rss" Print("Var Setup Completed")

United Kingdom

Unless you had each file start with a preceding name or letter

$basepath = "G:\Robot-"
$filename1 = "log.txt"
$filename2 = "data.txt"

The filenames would actually be Robot-log.txt and Robot-data.txt

Not ideal but unless I've missed it a variable cannot end with a \


Good catch Rich... my script ran because it had no context... no other commands associated with it....


you could try to use \ instead. I am not at a machine running ARC or i would test it for you.
$BasePath = "G:\"

\ is an escape code in C#. \ should give you \



$BasePath = "G:\"

Also resulted in error.

United Kingdom

No problem. I guess the outcome is that this is a limitation in EZ-Script and an alternative method is needed.

P.S. Thanks for the credit, you're number 250:D


maybe it is messing up because you misspelled weather in wather.rss


ya the wather weather was not relevant. The out come was just the EZ Script does not allow the \ character at the end of a string.


$path="C:\Users\ "

this can work to remove the extra space left at the end if you really wanted the \ at the end of the first variable

have any of you guys figured out how to print a forward bracket? i.e. "(" the backslash in front works for printing """ but not the (