It seems Windows insists on writing a backslash \
in file paths, whereas .NET's URI class writes them with a slash /
. Is there any right way, that is accepted even in the most primitive systems? And why is .NET's URI showing the other slash compared with the rest of Windows?
Windows uses backslashes for paths, while everything else seems to use forward slashes. Modern software tries to automatically correct you when you type the wrong type of slash, so it doesn't matter which type of slash you use most of the time.
The forward slash is the type you're most likely to see or use in writing. Forward (/) slashes serve many purposes in writing. They are commonly used to separate words, lines of poetry, abbreviations, dates, and fractions. Backslashes (\) are primarily used in computer coding.
The backslash is used only for computer coding. The forward slash, often simply referred to as a slash, is a punctuation mark used in English. The only time it is appropriate to use a comma after a slash is when demonstrating breaks between lines of poetry, songs, or plays.
Creating the \ symbol on a U.S. keyboard On English PC and Mac keyboards, the backslash key is also the pipe key. It is located above the Enter key (Return key), and below the Backspace key. Pressing \ key creates a backslash.
Windows is the bastard child of operating systems in this regard, but a lot of APIs will accept forward slashes as well. On Windows, a file path looks like this:
C:\Users\jsmith\Documents\file.txt
On a Unix-like system (including Mac OS X and Linux), the same path would look like this:
/home/jsmith/Documents/file.txt
A URL, standardized in RFC 1738, always uses forward slashes, regardless of platform:
http://home.example.com/Documents/file.txt
The reason for this is historical. Not even Windows can reverse our thinking on URLs. When you're talking about backslashes, the only platform you'll find that uses them is Windows (and some other novelty ones).
Where you might see backslashes used other than Windows would be UNC paths -- however, Windows is the chief proponent of these as well:
\\HOMESVR\Documents\file.txt
And whatever you do, don't make a commercial for your Web site and say "my company dot com back slash promotion".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With