Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Managing Files and Folders | File System and Automation Basics
Introduction to PowerShell

Managing Files and Folders

Sveip for å vise menyen

Navigating and managing the file system is a core skill in PowerShell. You use cmdlets to move through directories, view contents, and perform actions like creating, copying, or deleting files and folders. Some of the most common navigation commands include Get-ChildItem for listing directory contents, Set-Location for changing the current directory, and Get-Location to display your current path.

These commands help you interact with the file system efficiently from the command line, making it easy to automate repetitive tasks or manage large numbers of files.

New-Item TestFolder -ItemType Directory
New-Item TestFolder\example.txt -ItemType File
Copy-Item TestFolder\example.txt TestFolder\copy_example.txt
Remove-Item TestFolder\copy_example.txt
Remove-Item TestFolder -Recurse

When working with files and folders, you use file paths to specify their locations. A file path can be absolute (starting from the root, such as C:\Users\YourName\Documents) or relative (starting from your current directory, such as ./Documents). PowerShell also supports wildcards, which are special characters that help you match multiple files or folders with similar names. The * character matches any number of characters, and the ? matches a single character. For example, *.txt matches all text files in a directory, and file?.log matches file1.log, file2.log, and so on. Wildcards make it easier to perform actions on groups of files without specifying each one individually.

question mark

Which cmdlet is used to create a new folder in PowerShell?

Velg det helt riktige svaret

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 3. Kapittel 1

Spør AI

expand

Spør AI

ChatGPT

Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår

Seksjon 3. Kapittel 1
some-alt