How to find the cmdlet for a specific command prompt command (in general)

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of Mark Stepan Mark Stepan 6 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #37000
    Profile photo of Mark Stepan
    Mark Stepan
    Participant

    I'm fairly savvy with scripting and have been using the command prompt for a long time. Recently I came across a task that was well-suited for PowerShell, so now I want to "dive in". I've got a pretty good handle on the basics, but when it comes to actually using a new tool, I want to use it correctly. So, when it comes to any specific command prompt command, how do I locate the corresponding PowerShell cmdlet? Please don't just answer my "example" question ("teach me to fish"), but if, for example, I want to replace "ipconfig", "tracert", "ping", etc, with their PowerShell equivalents, how do I find them? I don't really want to be Googling every time (ideally). I know the help can be searched in a lot of ways. I'm hoping there's a way to list the aliases (or whatever).

    Thanks in advance.

    Mark

    #37001
    Profile photo of Don Jones
    Don Jones
    Keymaster

    First, understand that there isn't necessarily a 1:1 correspondence. That's key, because it means you'll need to focus more on the task being performed, or the info being retrieved. Think about those as nouns, and then – as cleverly described in "learn PowerShell in a month of lunches" – use Get-Command.

    Get-Command -Noun *address*

    As an example, would show me commands that work with addresses, such as, perhaps, an IP Address or a MAC address.

    This is different from searching help, and more inclusive. However, don't assume there's an equivalent to ipconfig or any other external application, because for the most part, there isn't. Unlike Dir or Cd or Del, which are indeed commands, Ipconfig and Netstat and so on – even Ping – aren't commands. They're complete applications (EXE files) that can be run within the Cmd shell or within PowerShell equally well.

    #37010
    Profile photo of Mark Stepan
    Mark Stepan
    Participant

    Thanks Don, that helps! Much appreciated.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.