Loading, please wait...

A to Z Full Forms and Acronyms

PowerShell Scripts

Jun 24, 2021 PowerShell, 2788 Views
PowerShell Scripts on Files and Folders

PowerShell Scripts on Files and Folders

PowerShell - To Create a Folder

Command - New-Item is used to create a directory and passing -ItemType as Directory

New-Item -Path 'D:\NewFolder\TutorialsLink' -ItemType Directory

PowerShell - To Create a File

Command - New-Item is used to create a file and passing -ItemType as File

New-Item -Path 'D:\NewFolder\TutorialsLink\File.txt' -ItemType File

PowerShell - To Copy a directory

Command - Copy-Item is used to copy a directory to a different directory

Copy-Item 'D:\NewFolder\TutorialsLink' 'D:\NewFolder2\TutorialsLink2'

PowerShell - To copy a File

Command - Copy-Item is used to copy a file from a directory to another

Copy-Item 'D:\NewFolder\TutorialsLink\File.txt' 'D:\NewFolder2\TutorialsLink2\File2.txt'

PowerShell - To Check a folder existence

Command - Test-Path is used to check the existence of a folder

Test-Path D:\TutorialsLink\Folder
A to Z Full Forms and Acronyms

Related Article