Thursday, February 23, 2012
   
Text Size

PowerShell - Create A File

Microsoft PowerShell - Create A File

windows_powershell

To create a file 'c:\temp\andy\andy.txt':

#Check for file c:\temp\andy\andy.txt and create if doesn't exist
If (Test-Path c:\temp\andy\andy.txt)
{
    "File Exists"
}
Else
{
    "File Doesn't Exist"
    new-item c:\temp\andy\andy.txt -type file
}