November 2018
Intermediate to advanced
566 pages
17h 15m
English
The first task that this recipe does is create files and directories. By providing multiple parent paths to the Join-Path cmdlet, we create demo.txt at four locations. We use the Foreach-Object cmdlet to perform this iterative task. Next, we twist the process a little; we pass several strings into the pipeline, and then use a Join-Path subexpression within New-Item, thereby creating multiple child paths at the parent location.
New-Item can create items based on what you define as the ItemType.
Next, we rename a file using the Rename-Item cmdlet, copy a file using the Copy-Item cmdlet, and recursively delete a directory using the Remove-Item cmdlet with the Recurse switch.
Read now
Unlock full access