create new file powershell code example

Example 1: powershell new folder

New-Item -ItemType directory -Path C:\Scripts\newDir

Example 2: powershell make file

New-Item <filename.filetype>

Example 3: powershell new file

New-Item -Path . -Name "testfile1.txt" -ItemType "file" -Value "This is a text string."

Example 4: how to make file in powershell

echo $null >> filename.type

Example 5: powershell create file and directory

New-Item -Path '.\hello\test\file.txt' -ItemType File -Force

Example 6: powershell create new file and open

ni $file | psedit