Chapter 22. Working with Files and the Registry in PowerShell

Working with files is one of the most basic roles that a shell must fill. In this chapter you'll see how PowerShell does that, but also how it uses providers to make the same commands valid filesystems, the registry and more.

Using PSDrives, Accessing the File System, Mapping Drives

First, a little history ...

Back in the 1970s, the CP/M operating system used a convention of A: for the first floppy disk drive and B: for the second, and this was duplicated in the first version of MS-DOS. When support for hard disks was needed, DOS 2.0 named the first hard disk volume C:, and added hierarchical directories in a similar style to UNIX ones—the two most obvious differences being, first, that UNIX uses the forward slash ( / ) to separate directories on the path whereas Microsoft operating systems use the backward slash ( \ ), and second, that UNIX mounts additional disks into a hierarchy with a single root, where traditionally each volume in a Microsoft operating system has a separate root. In fact, from the early days of DOS, Microsoft operating systems have featured the command SUBST, which allows a long path to be presented as its own drive letter.

Current Microsoft operating systems don't require a drive letter per disk. Like UNIX, they can mount a volume into ...

Get Microsoft® PowerShell, VBScript and JScript® Bible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.