Deborah R. Fowler
Path Symbols
Posted on Feb 27
2022A note about forward / and backward \ slash in programming context
In Windows OS:
- backslash is used to separate directories
(folders) in path names. So for example C:\Program Files\Side
Effects Software\Houdini 19.0.383
- most applications will correct for the
slash direction, so if you typed forward slashes in the file
explorer in Windows it would still take you there but if you
look at the path where you are you will see the backslash in
the path
- note that when I use this in my command line
rendering script I want to use it as a string so I
type renderCmd = "\"C:/Program Files/Side Effects
Software/Houdini 19.0.531/bin/hrender.py\"" This
is inside a python script and the variable will use forward
slashes with the escape sequence for the quotation marks.
This is a very specific instance.
- forward slash is used if it is a relative
path
Finally in programming languages:
- forward slash is used for division (python, C++ etc.)
- backward slash is used in escape sequences for example \n is a newline, \t is a tab
And a letter r in front of a string identifies
it as a raw string so that backslashes are treated as literal
characters (not my favorite syntax, but google searches might
lead you to this syntax)
- note that in the above command line script this would look like renderCmd = r'"C:/Program Files/Side Effects Software/Houdini 19.0.531/bin/hrender.py"'