Create files and folders with New-Item
The forgotten PowerShell way to touch files and mkdir directories — including hard links and junctions.
01Command
$ New-Item -Path 'C:\Temp\notes.txt' -ItemType File ; New-Item -Path 'C:\Temp\logs' -ItemType Directory02What it does
New-Item is PowerShell's all-purpose creator: File, Directory, and on Windows also SymbolicLink, Junction, and HardLink via -ItemType. It creates intermediate parent directories automatically, so a single New-Item can build a deep path. -Value seeds the file with content, and -Force replaces an existing file instead of erroring.
03Risk
04Undo
$ Remove-Item 'C:\Temp\notes.txt'05Sources
- New-Item - PowerShellEvidence: SS64 lists supported -ItemType values including File, Directory, SymbolicLink, Junction and HardLink.
- New-Item | Microsoft LearnEvidence: Microsoft documents New-Item with -ItemType File/Directory/SymbolicLink/Junction/HardLink and -Force to replace an existing file.
Last verified: 2026-09-17 · Category: Files & Folders
06Related solutions
Diagnose NTFS file system errors and bad sectors on any volume — including the system drive while Windows is running — before committing to a repair.
Robocopy is Windows' built-in robust file copier: use /MIR to keep a destination folder as an exact one-way mirror of a source, resumable and restartable.
Search inside text files and logs with regex, returning file, line number and match.