- PowerShell Tutorial
- PowerShell - Home
- PowerShell - Overview
- PowerShell - Environment Setup
- PowerShell - Cmdlets
- PowerShell - Files and Folders
- PowerShell - Dates and Timers
- PowerShell - Files I/O
- PowerShell - Advanced Cmdlets
- PowerShell - Scripting
- PowerShell - Special Variables
- PowerShell - Operators
- PowerShell - Looping
- PowerShell - Conditions
- PowerShell - Array
- PowerShell - Hashtables
- PowerShell - Regex
- PowerShell - Backtick
- PowerShell - Brackets
- PowerShell - Alias
- PowerShell Useful Resources
- PowerShell - Quick Guide
- PowerShell - Useful Resources
- PowerShell - Discussion
Powershell - Create File
Cmdlet
New-Item cmdlet is used to create a file by passing the path using -Path as path of the file and -ItemType as File.
Example
In this example, we'll create a file in D:\Temp\Test Folder with name "Test File.txt"
Type the following command in PowerShell ISE Console
New-Item -Path 'D:\temp\Test Folder\Test File.txt' -ItemType File
Output
You will see the following output.
Directory: D:\temp Mode LastWriteTime Length Name ---- ------------- ------ ---- -a--- 4/3/2018 7:14 PM 0 Test File.txt
You can see the same in Windows Explorer where Test File.txt is created in D:/temp/Test Folder directory.
powershell_files_folders.htm
Advertisements
To Continue Learning Please Login
Login with Google