Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Pipeline parameter by property name

$
0
0

Hi, I just joined this community, I hope to learn and help as possible. They will excuse my English is not very good.

 

Well, I'm learning to use powershell and I found a question, that I detail below:

 

I have a doubt about pipeline, I learned that there are two way to parameterize pipeline [For value and property name] better explain it with an example of what I want to do:

I have a txt file with the following:

name, value, noun

gp, get-process, service

gch, get-childitem, write

In powershell I write the following commands

       > $ Path = import-csv. \ Alias.txt

       > $ Path | new-alias -force       

Now I explain the problem: What I have is a set of parameters [name, value and noun] in a file, I import a csv file, put it in a variable, and here's what I find interesting, pipeline also helps me to parameterize parameters to other commands [Eye only those commands that can parameterize], the alias works for me, I believe the gp and gch alias. Now comes my question: In the same file can have different parameters and execute commands that read ??? In this case I have another "noun" column having values ​​of "service" and "write" are parameters that get-command, and I want to run:

       > $ Path | get-command

I show all the commands that contain the word "service and write" and ignoring the clear "name and value" columns that used to run the command "new-alias".

Well thanks for your time and hope to learn together with you xD


Viewing all articles
Browse latest Browse all 6937

Trending Articles