Cmdlet

Cmdlet


  • A cmdlet (pronounced "command-let") is a special type of command provided in the Windows PowerShell command line environment. They allow users to put certain enhanced operating system functions into effect. Cmdlets are especially useful when used as part of a script or batch file, but they can also be typed at the command prompt. Their command names take the form of a capitalized verb-and-noun pair conjoined with a dash, for instance, "Get-Help".

  • The following sections contain a list of useful cmdlets you can use in the Windows PowerShell, as well as examples of them in action.

    Get-Command

  • The Get-Command cmdlet lists other cmdlets. Typing "Get-Command" with no options will list all available cmdlets (and there are a lot of them). It's much more useful to use Get-Command to search for a cmdlet that contains a certain string, using the -name option. For instance, to search for the cmdlet "Initialize-Volume":

    Get-Command -name Initialize-Volume
    ...or, you can use wildcards to perform a partial match on a cmdlet's name. For instance, the command:

    Get-Command -name *Vol*
    ...will list all cmdlets that have the letters "Vol" in their name.

    Get-Help

  • The Get-Help cmdlet displays a help message giving you more information about how to properly use a cmdlet. For instance, to find out more information about the Get-Process cmdlet, run:

    New-Item

    Get-Help Get-Process

  • The New-Item command is a convenient way to create a new file or directory on your computer from the command line. You may specify that the item to be created is a file or a directory using the -type option. For instance, to create a new directory called C:\My Folder, you could use the command:

    New-Item "c:\My Folder" -type directory
    ...and to create a file called C:\My Folder\new file.txt, you could use the command:

    New-Item "c:\My Folder\new file.txt" -type file
    It's important to put the file or directory name in quotes if it contains spaces, as we have done in these examples.

    Get-Location

  • The Get-Location cmdlet will tell you what your current directory is. For instance:

    Get-Location

    Set-Location

  • The Set-Location cmdlet changes the working
    directory to one that you specify. For instance, to change the current directory to C:\temp, you could use the command:

    Set-Location C:\temp

    Other cmdlets

  • For more information and examples of cmdlets to use in Microsoft PowerShell, Microsoft maintains a PowerShell documentation site. It provides details about PowerShell, including cmdlets and help on how to use the cmdlets in scripts on your system.


    What is an Operating System? » Computer Shortcut Keys and their Functions » Keyboard Function Keys » Computer Basics - Hardware - Software - Parts

    Short Stories for Kids - Moral Stories – English Short Stories for Children - Moral Stories for Kids - Stories for Kids - Funny Story for Kids - Scary Stories for Kids - Really Funny Short Stories - Bedtime Stories
    Proverb Stories
    Powerful Motivational Quotes for Students » Success Quotes » English Short Stories for Kids

    Cabin Crew Jobs & Career Advice » Secretary Job Description » Receptionist Job Description » Top 100 Interview Questions and Answers » How to Prepare for an Interview » How to Write a CV » How to Choose a Career » Computer Shortcut Keys and their Functions

    Scholarships in Australia » Scholarships in Austria » Scholarships in Belgium » Scholarships in Canada » Scholarships in Germany » Scholarships in Ireland » Scholarships in Italy » Scholarships in Japan » Scholarships in Korea » Scholarships in Netherlands » Scholarships in Switzerland » Scholarships in UK » Scholarships in USA

    Scholarships for Study in Africa » Scholarships for African Students » Undergraduate Scholarships » African Women Scholarships & Grants Scholarships for Study in Africa » Scholarships for African Students » Undergraduate Scholarships » African Women Scholarships & Grants Scholarships for Study in Africa » Scholarships for African Students » Undergraduate Scholarships » African Women Scholarships & Grants Short Stories for Kids - Moral Stories – English Short Stories for Children - Moral Stories for Kids - Stories for Kids - Funny Story for Kids - Scary Stories for Kids - Really Funny Short Stories - Bedtime Stories
    Proverb Stories
    Powerful Motivational Quotes for Students »

  • Click here to post comments

    Join in and write your own page! It's easy to do. How? Simply click here to return to Computer Basics FAQ.