Get Help
Get-Help command which gives you an explanation about how to give a command and its parameter.
<command> Get-Help
Create Folder
New-Item -Path ‘D:\temp\Test Folder’ -ItemType Directory
Create File
New-Item -Path ‘D:\temp\Test Folder\Test File.txt’ -ItemType File
Copy Folder
Copy-Item ‘D:\temp\Test Folder’ ‘D:\temp\Test Folder1’
Copy Folder
Copy-Item ‘D:\temp\Test Folder\Test File.txt’ ‘D:\temp\Test Folder1\Test File1.txt’
Delete Folder
Remove-Item ‘D:\temp\Test Folder1’
Remove-Item ‘D:\temp\Test Folder’ -Recurse
Delete File
Remove-Item ‘D:\temp\Test Folder\test.txt’
Remove-Item ‘D:\temp\Test Folder\test.txt’ -Recurse
Move Folder
Move-Item D:\temp\Test D:\temp\Test1
Move File
Move-Item D:\temp\Test\Test.txt D:\temp\Test1
Rename Folder
Rename-Item D:\temp\Test D:\temp\Test1
Rename File
Rename-Item D:\temp\Test\test.txt test1.txt
Retrieve Item
Get-Content D:\temp\Test\test.txt
(Get-Content D:\temp\test\test.txt).length
Check Folder Existence
Test-Path D:\temp\test
Check File Existence
Test-Path D:\temp\test\test.txt
Get System Date
Get-Date
Get-Date -DisplayHint Date
Set System Date
set-date -Date (Get-Date).AddDays(1)
set-date -Date (Get-Date).AddDays(-1)
Get System Time
Get-Date
Get-Date -DisplayHint Time
Set System Time
get-date -displayHint time
$timeToAdd = New-TimeSpan -Minutes 60
set-date -adjust $timeToAdd
Create Text File
New-Item D:\temp\test\test1.txt
Set-Content D:\temp\test\test2.txt ‘Hello World!’
Read Text File
Get-Content D:\temp\test\test2.txt
Create XML File
New-Item D:\temp\test\test.xml -ItemType File
Set-Content D:\temp\test\test.xml ‘‘
Read XML File
Get-Content D:\temp\test\test.xml
Create CSV File
New-Item D:\temp\test\test.csv -ItemType File
Set-Content D:\temp\test\test.csv ‘Alice,Bob,Charlie’
Read CSV File
Get-Content D:\temp\test\test.csv
Create HTML File
New-Item D:\temp\test\test.html -ItemType File
Set-Content D:\temp\test\test.html ‘Hello World!‘
Read HTML File
Get-Content D:\temp\test\test.html
Erase File Content
Clear-Content D:\temp\test\test.txt
Append Data
Set-Content D:\temp\test\test.txt ‘Hello’
Add-Content D:\temp\test\test.txt ‘World!’