From the course: Complete Guide to PowerShell 7
Unlock this course with a free trial
Join today to access over 24,400 courses taught by industry experts.
Combining pipelines and variables - PowerShell Tutorial
From the course: Complete Guide to PowerShell 7
Combining pipelines and variables
- [Instructor] Okay, so one of the things that we might want to do is combine the use of variables with the pipeline. Now of course, we already looked at using the pipeline itself. So normally a commandlet outputs values, and then we pipeline that into something else. Now we can do the same thing with variables. 'cause variables can contain different types of data. So a simple example here would be a file extension list. So we have a variable here which contains star.txtcsv and log. So let's just populate that variable if we choose run selection. And then if I select file extensions and just choose run, you'll see it has an array of those three objects. So now that we have an array of data, it means that we can effectively iterate over that data. So what we can do here is we can say file extensions, which is our variable. And then because it's a data object or a PowerShell object, we can pipe that into anything. So for this example, we are going to iterate through the array. So for…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
(Locked)
Introduction to variables12m 11s
-
Creating and using variables13m 48s
-
(Locked)
Variable scopes10m 32s
-
(Locked)
Introduction to pipelines9m 27s
-
(Locked)
Using pipelines effectively10m 53s
-
(Locked)
Combining pipelines and variables8m 39s
-
(Locked)
Backticks vs. splatting vs. class objects15m 5s
-
(Locked)
-
-
-
-
-
-
-
-
-