4 ms·
Windows already does accept forward slash in paths and has for a while. The back slash still lives for legacy applications and unfortunately probably will for
by guy1543 10y ago
Windows already does accept forward slash in paths and has for a while. The back slash still lives for legacy applications and unfortunately probably will for a long long time.
- sebtoast 10y agoI just tried and it works in Windows... I didn't know that despite using cmd/powershell everyday.
- Mithaldu 10y agoDepends on what you're doing. `dir relative/path` does not work.
- chris-at 10y agoDid you try it on Windows 10? If I try to open a file `i:/foo/bar/test.txt` I get `The file name is not valid` (from Notepad)
- kej 10y agoI just did exactly that on Windows 10 and it worked just fine.
- hackuser 10y agoHow is it possible I didn't know that? Thank you. Does anyone know the history of it? I did a little research: * I found someone asking the same question as me in 2005 (!) [1] * Per someone on Stack Overflow: "/ can be used as a path separator at the API level, but you aren't calling the API directly. You're using cmd.exe, and cmd.exe parses the / as a command line option" [2] * Later in the same Stack Overflow discussion someone performs a series of tests on Vista, with some inconsistent results. [2] * Here's a history by veteran Microsoft developer Larry Osterman, which takes us back to the developers of MS-DOS and also mentions other undocumented ways MS-DOS can/could be made Unix friendly. [3] ----- [1] https://bytes.com/topic/python/answers/23123-when-did-windows-start-accepting-forward-slash-path-separator https://bytes.com/topic/python/answers/23123-when-did-window... [2] https://stackoverflow.com/questions/10523708/why-does-the-cmd-exe-shell-on-windows-fail-with-paths-using-a-forward-slash https://stackoverflow.com/questions/10523708/why-does-the-cm... [3] https://blogs.msdn.microsoft.com/larryosterman/2005/06/24/why-is-the-dos-path-character/ https://blogs.msdn.microsoft.com/larryosterman/2005/06/24/wh...
- pwg 10y ago> How is it possible I didn't know that? Thank you. Does anyone know the history of it? I did a little research: According to the history, DOS 2.0: https://blogs.msdn.microsoft.com/larryosterman/2005/06/24/why-is-the-dos-path-character/ https://blogs.msdn.microsoft.com/larryosterman/2005/06/24/wh... [begin quote] Here’s a little known secret about MS-DOS. The DOS developers weren’t particularly happy about this state of affairs – heck, they all used Xenix machines for email and stuff, so they were familiar with the nix command semantics. So they coded the OS to accept either “/” or “\” character as the path character (this continues today, btw – try typing “notepad c:/boot.ini” on an XP machine (if you’re an admin)). And they went one step further. They added an undocumented system call to change the switch character. And updated the utilities to respect this flag. And then they went and finished out the scenario: They added a config.sys option, SWITCHAR= that would let you set the switch character to “-“. Which flipped MS-DOS into a nix style system where command lines used “-switch”, and paths were / delimited. [end quote]
- sixothree 10y agoUnfortunately it does not work when specifying a server name like \\server1.