New-Item
Use New-Item to create a new item, such as a file, directory, registry key, or provider-specific object.
Documentation: Microsoft Learn — New-Item
Syntax
See the command anatomy
Read the command and its supplied arguments. This example requires real PowerShell or its module; this diagram does not execute it.
New-Item [-Path] <String[]> [-ItemType <String>] [-Value <Object>] [<CommonParameters>]- Stage 1New-Item
-Path -ItemType -Value
Try it
PowerShell example · browser support is limited.
Execution scope: The full example below requires PowerShell outside this browser. You can edit this runner to use the supported practice commands; unsupported syntax returns an explanation.
Follow the objects
Run the command to inspect each stage.
Examples
New-Item -Path C:\Ops
Show reference output
Sample output · fictional data, shaped like the real thing
Directory: C:\ Mode LastWriteTime Length Name ---- ------------- ------ ---- d---- 10/14/2026 11:30 AM Ops
New-Item -Path C:\Ops\report.txt
Show reference output
Sample output · fictional data, shaped like the real thing
Directory: C:\Ops Mode LastWriteTime Length Name ---- ------------- ------ ---- -a--- 10/14/2026 11:30 AM 0 report.txt
New-Item -Path HKCU:\Software\Contoso
Show reference output
Sample output · fictional data, shaped like the real thing
Hive: HKEY_CURRENT_USER\Software
SKC VC Name Property
--- -- ---- --------
0 0 Contoso {}Parameters
Parameter definitions:
-Path-ItemType-Value
Practical use and troubleshooting
Practical scenario: Use New-Item when you need to create a new item, such as a file, directory, registry key, or provider-specific object. Start with one identified target and inspect the returned values before extending the operation to a list. Keep the identity in your report so you can trace each result back to the object or path that produced it.
Common error and fix: An item-already-exists error can mean the script was run twice. Check Test-Path, decide whether reuse is appropriate, and do not overwrite an existing file merely to silence the error. In an unattended script, capture this failure with its original error record and record which target failed. An empty result and an unsuccessful query must remain distinguishable in the final report.
See also: Copy-Item. New-Item creates an item at the requested path; Copy-Item copies an existing item. Creating a directory does not automatically copy a folder tree into it. Read the linked command before substituting it; similar names do not imply identical inputs or output.
Put this command to work
Create a report directory
Create C:\Lab\Reports as a directory.
The sandbox is visible now. Sign in with Google only when you run or check a task; commands and temporary files are discarded when you leave.
Run a command to inspect its result.
Inspect starting data
Supported syntax
Virtual files
Recap
New-Item Use New-Item to create a new item, such as a file, directory, registry key, or provider-specific object.
Next: Get-Item