Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

Powershell - Create Folder

New-Item -Path 'D:\temp\Test Folder' -ItemType Directory


Powershell - 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-Item 'D:\temp\Test Folder' -Destination 'D:\temp\Test Folder1'
-Copy Files
Copy-Item 'D:\temp\Test Folder\Test File.txt' 'D:\temp\Test Folder1\Test File1.txt'
Copy-Item -Filter *.txt -Path 'D:\temp\Test Folder' -Recurse -Destination 'D:\temp\
Test Folder1'
-Remove-Item
Remove-Item 'D:\temp\Test Folder1'
Remove-Item 'D:\temp\Test Folder' -Recurse
Remove-Item 'D:\temp\Test Folder\test.txt'
Remove-Item 'D:\temp\Test Folder' -Recurse
-Move Item
Move-Item D:\temp\Test D:\temp\Test1
Move-Item D:\temp\Test\Test.txt D:\temp\Test1
-rename
Rename-Item "D:\temp\Test Test1"
Rename-Item D:\temp\Test\test.txt test1.txt
-retrive/access
Get-Content D:\temp\Test\test.txt
(Get-Content D:\temp\test\test.txt).length

=====================================================
create read and write into text file
New-Item D:\temp\test\test.txt it will create text file
Set-Content D:\temp\test\test.txt 'Welcome to TutorialsPoint' this will add content
to the file
get-Content D:\temp\test\test.txt reading the file
Set-Content D:\temp\test\test.txt 'Hello'
Add-Content D:\temp\test\test.txt 'World!' this will append the data
=====================================================

You might also like