Windows ignores double backslashes. So while the second syntax with
is correct and you should use that one, the first with \
works too.
The only exception is double-backslash at the very beginning of a path that indicates a UNC path.
See Universal Naming Convention.
Though note that in many programming languages like C, C++, Java, C#, Python, PHP, Perl, a backslash works as an escape character in string literals. As such, it needs to be escaped itself (usually with another backslash). So in these languages, you usually need to use a double backslash in the string literal to actually get a single backslash for a path. So for example in C#, the following string literal is actually interpreted as C:PersonalMyFolderMyFile.jpg
:
var path = "C:\Personal\MyFolder\MyFile.jpg";
Though there are alternative syntaxes. For example in C#, you can use the following syntax with the same result:
var path = @"C:PersonalMyFolderMyFile.jpg";
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…