file system – Since when does Home windows help ahead slash as path separator?
TL;DR: Home windows didn’t explicitly help each, however DOS did since 2.0
The reply is quite a transparent “sure however” (*1):
- DOS 2.0 and later supported each methods, thus all DOS features will work correctly both method.
- Newer Home windows Variations (NT and later) copied that behaviour
- Home windows functions didn’t all the time observe and should or might not settle for both when parsing for filenames.
The Lengthy Learn
Since when does Home windows help ahead slash as path separator?
This relies fairly on the point of view taken. In any case, early Home windows is a GUI on high of DOS, initially utilizing DOS and including a layer to it, not changing it. DOS in flip supported each slashes as path separators since 2.0. (*1)
The MS-DOS Encyclopedia notes on page 284 relating to path names:
Names in pathnames handed to Interrupt 21H features could be separated by both a again slash () or a ahead slash (/). (The ahead slash is the separator character utilized in path names in UNIX/XENIX techniques.) For instance, the pathnames
C:/MSP/SOURCE/ROSE.PAS
andC:MSPSOURCEROSE.PAS
are equal when handed to an Interrupt 21H perform.
Thus all DOS features that take a path identify – and all Home windows perform that ahead a path identify to DOS – will help each methods (*2) since Home windows 1.0 (*3)
This will simply be tried on-line utilizing PCjs with a Windows 1.01 image (*4)
(Because of DL444 for the thought :))
Opening Notepad with a full filename utilizing ahead slashes.
This leads to Notepad opening that file and displaying the trail identify in its title bar:
Ensuing opened file in Notepad
Besides, the title line is a bit unusual. Usually Notepad reveals, like all early home windows functions, solely the file identify, with out path or drive (*5), as seen right here when navigating with the open dialog:
Opening the test-file utilizing the open dialog field.
However when utilizing a path a command line argument the drive is gone however the path nonetheless seen. Doing the identical with ahead slashes reveals a outcome like utilizing the opening dialog:
Now with again slashes
Utilizing again slashes provides the identical output as utilizing the dialog field:
Now it solely reveals the file identify, no path
Ergo, the (DOS?) file perform used work with both slash (*6), however functions like Notepad did under no circumstances care a few ahead slash. Regardless of presumably being written by the exact same workforce that did Home windows and for positive in response to all pointers on the time.
Many Years Later (Win10)
Utilizing Win 10 CMD to start out Notepad utilizing ahead slashes works higher than anticipated:
Clearly Notepad has realized a bit throughout the final 38 years :))
Conclusion: It Does, However it’s Incoherent.
The DOS/file system elements of Home windows all the time did and nonetheless do help each separators, different elements might or might not (*7) – though they did enhance over time.
*1 – BTW: The merchandise has already been requested and answered.
*2 – That is why slash is a forbidden character in file identify entries – and a identified solution to obfuscate software program.
*3 – Home windows 1.0 requires DOS2.0 or later – however then once more, there aren’t any path names previous to 2.0, in order that’s moot anyway :))
*4 – All following screenshots and observations taken with this setup of PCjs, DOS 2.0 and Home windows 1.01.
*5 – And all uppercase.
*6 – Beginning with 3.0 DOS itself makes use of an inside perform (INT 2Fh function 1204h) to transform slashes. Apparently utilizing a WCHAR – I might assume to help MBCS.
*7 – Which in flip will not be precisely uncommon for Home windows