July 2018
Beginner
552 pages
13h 18m
English
Another area where you should become very confident is working with files, as you will need to work with them very frequently. First, we will take a look at the basics of working with files by retrieving and writing files and the content of the files. This can be achieved with the Get-Content and Set-Content/Out-File cmdlets.
First of all, we will take a dedicated look at how you can export content to a file:
#Storing working location$exportedProcessesPath = 'C:\temp\exportedProcesses.txt'#Write processes table to file and show the result in Terminal with the -PassThru flagGet-Process | Set-Content -Path $exportedProcessesPath #Open file to verifypsedit $exportedProcessesPath#retrieving processes and exporting them to fileGet-Process ...