Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I've started a new job working for a firm that uses a full windows stack. I feel like I've gone backwards in terms of productivity, not because Windows is less powerful, but because I'm just really unfamiliar with the environment. I find myself constantly banging my head against Powershell, throwing up my hands, and banging out whatever it was I was trying to do in Cygwin. I feel like this is a dirty solution, and would prefer to get comfortable in the proper Windows environment.

With that said, how should a beginner like myself be searching through get-command's output for general cmdlets I'd like to perform? I understand I should be thinking in an object space, so is there an elegant way to search through the properties presented so I can do things like, say, find out if there is an alias for a particular cmdlet, or to search if a cmdlet is even available? (was looking for a symlink cmdlet, and would prefer to stay in the cmdline over googling if possible).

The lack of grep/piping is driving me crazy. I must be missing something, any advice given my predicament?

share|improve this question

closed as off topic by Joey, Hennes, soandos, 8088, Diogo Nov 5 '12 at 11:28

Questions on Super User are expected to relate to computer software or computer hardware within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

    
This question is a bit too broad. More specific questions like ("how do I filter dir output to only list .exe files over 1MB") will produce a specific answer that ALSO teaches PowerShell syntax. –  Jay Bazuzi Nov 4 '12 at 22:57

2 Answers 2

up vote 2 down vote accepted

Ok heres some things I wish I had known when starting PowerShell:

To check if a command exists you could do something like this:

Get-Command *Item*

To see what properties an object has you can do something like this:

$Items = Get-ChildItem -Path C:\
$Items | Get-Member  

To see if there is an alias for something you can use:

Get-Alias -Definition Get-ChildItem

Finally to see how to use a command you can use:

Get-Help Get-ChildItem

Also PowerShells Pipline is one of its strongest selling points, you do know about the "|" pipe symbol right?

share|improve this answer

I'm going to use the abbreviated forms, assuming you're typing at the command line and want speed. In a script, I like full names for maintainability.

find out if there is an alias for a particular cmdlet

This works, but I can never remember it:

PS> gal -def get-childitem

so I use a query instead:

PS> gal | ? { $_.Definition -eq "Get-ChildItem" }

? is an alias for Where-Object, so that is how you filter output.

search if a cmdlet is even available? (was looking for a symlink cmdlet, and would prefer to stay in the cmdline over googling if possible).

I might try:

PS> help *link*

But I often go to Google, which returned me to StackOverflow (of course!) http://stackoverflow.com/questions/894430/powershell-hard-and-soft-links

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.