Skip to content

New-Item

The New-Item cmdlet in PowerShell is used to create a new item (file, directory, registry key, etc.) at the specified location.

Here’s how to use New-Item:

  1. Open PowerShell by searching for it in the Start menu or by pressing Win + X and selecting “Windows PowerShell” or “Windows PowerShell (Admin)”.
  2. Once PowerShell is open, you can use the New-Item cmdlet followed by the path and name of the item you want to create. For example:
  • To create a new directory: New-Item -ItemType Directory -Path C:\NewFolder
  • To create a new text file: New-Item -ItemType File -Path C:\NewFolder\NewFile.txt
  • You can also use parameters such as -Value to specify the initial content of the item being created.
  1. After executing the New-Item cmdlet with the desired parameters, PowerShell will create the new item at the specified location.

Source for More Information

Here’s a source where you can find more detailed information about New-Item and other PowerShell cmdlets:

The Microsoft Docs page provides comprehensive documentation on PowerShell cmdlets, including New-Item, with detailed explanations, examples, and usage scenarios.

Leave a Reply

Your email address will not be published. Required fields are marked *