Hacker News new | past | comments | ask | show | jobs | submit login

Every process in the system has a current working directory, which is used to resolve all relative paths passed to (Win32) file system APIs. That is a single working directory per-process, not per-drive. In this regard, Windows’ behaviour is very similar to that of Unix-like systems (including Linux and macOS)



Does DOS have a per-process per-drive working directory? That would be the only time where they'd be comparable. I would expect the system for managing per-process and per-terminal CWDs to be completely separate and not interlinked.


> Does DOS have a per-process per-drive working directory?

In DOS, there is a system-wide current drive, and system-wide per-drive current directory. For a Windows DOS box (and 16-bit Windows apps), "system-wide" is per VM, maintained by the virtual machine manager (VMM in Windows 2.x/3.x/9x/Me, NTVDM for NT and successors)

In 32-bit/64-bit Windows, there is a single directory per-process. CMD.EXE provides an (incomplete) emulation of the old DOS model using environment variables; COMMAND.COM performed no equivalent function, it relied on the DOS kernel to track them on its behalf, essentially the same as any other DOS program did

> I would expect the system for managing per-process and per-terminal CWDs to be completely separate and not interlinked.

It isn't actually "per-terminal"; a Windows console in itself has no concept of current drive or directory, and can simultaneously host multiple processes each with different current directories. Consoles also have nothing to do with this "per-drive current directory" emulation performed by CMD.EXE, which is implemented using per-process environment variables




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: