Category: 2. PowerShell Cmdlet Advance

  • PowerShell Set-Content | PowerShell write to file

    The PowerShell Set-Content cmdlet writes the new content or replacing the existing content in a file. It differs from the Add-content cmdlet, which appends the content to the file. To send the content to the Set-Content cmdlet, we can use the -Value parameter on the command line, or we can send a content through the pipeline. The sc is the alias…

  • PowerShell Get-Date

    The Get-Date cmdlet in PowerShell displays the current date and time on the PowerShell console. This cmdlet gets a DateTime object. We can also use the Get-Date to generate and send the date and time character string to the other cmdlets or programs. Syntax Parameters Following are the parameters used in Get-Date cmdlet: -Date This parameter allows you to specify a…

  • PowerShell Get-Content

    The PowerShell Get-Content cmdlet gets the content of an item at a specified location. The gc, cat, and type are the aliases of this cmdlet. Syntax Parameters -Filter The -Filter parameter is used to specify a filter to qualify the -Path parameter. The FileSystem provider is the only PowerShell provider that supports the uses of filters. This parameter is more efficient as the…

  • PowerShell Clear-Content

    The Clear-Content cmdlet deletes the content of an item, but it does not delete the item, such as deleting the text from the file. As a result, an item exists, but that item is empty. This cmdlet works on an item with content, instead of items with values. The clc is the alias for this cmdlet. Syntax Parameters -Path…

  • PowerShell Add-Content | PowerShell Append to file

    The Add-Content cmdlet appends the content to the specified item or a file, such as adding words to the file. We can specify the content by typing it in the cmdlet or by specifying an object which contains the content. Syntax Parameters -Path The -Path parameter is used to specify the path to the items which receives…