PS
Powershell Tutorial Online

Powershell Create File

Scenario 1: Folder alrady present like here "c:\test"


# Using PowerShell commnads to create a new file
$Location = "C:\test"
New-Item -Path $Location -Name "FirstCreateFile.txt" -ItemType File

Scenario 2: Folder is not there


# Using PowerShell commnads to create a new file if folder is not there
$Location = "C:\test"
New-Item -Path $Location -Name "FirstCreateFile.txt" -ItemType File


Scenario 2: Folder is not there with force create folder


# Using PowerShell commnads to create a new file if folder is not there
$Location = "C:\test"
New-Item -Path $Location -Name "FirstCreateFile.txt" -ItemType File