2.3
Get-ChildItem -Path C:\Windows -Filter *.txt -Recurse
Get-ChildItem -Path C:\Windows -Filter *help*.txt -Recurse
Get-ChildItem -Path C:\Windows -Recurse | Where-Object { $_.Name -match 'printer' -and $_.Extension -match '^\.\w{1,3}$' }
Get-ChildItem -Path C:\Windows -Filter printer*.dll -Recurse
2.4
Set-Location ENV:
Get-ChildItem
Set-Location Alias:
Get-ChildItem
Get-ChildItem | Where-Object { $_.Definition -eq "Clear-Host" }
Set-Location Function:
Get-ChildItem
Set-Location Alias:
Get-ChildItem | Where-Object { $_.Definition -eq "New-Item" -and $_.Name -eq "mkdir" }
Set-Location Cert:
Get-ChildItem
Get-ChildItem -Recurse
Set-Location Alias:
Get-ChildItem
Get-ChildItem | Where-Object { $_.Definition -eq "Clear-Host" }
Set-Location ENV:
Get-ChildItem
Set-Location Cert:
Get-ChildItem
Get-ChildItem -Recurse
Set-Location Function:
Get-ChildItem
Set-Location Alias:
Get-ChildItem | Where-Object { $_.Definition -eq "New-Item" -and $_.Name -eq "mkdir" }
2.5
New-Item -ItemType directory -Path C:\data1
1..50 | ForEach-Object {New-Item -ItemType File -Path C:\data1 -Name "File $_.txt"}
2.6
New-Item -Path . -Name "data_backup" -ItemType "Directory"
Copy-Item -Path .\data1\* -Destination .\data_backup\ -Recurse
3.1
Start-Process mspaint
Start-Process notepad
Get-Process | Export-Csv -Path .\processen.csv -NoTypeInformation
Get-Process notepad, mspaint | Stop-Process
3.2
$processes = Import-Csv -Path .\processen.csv
$processes
Get-Content -Path .\processen.csv
4.1
# Declaratie van variabelen
$a = 10
$b = 5
# Berekeningen
$som = $a + $b
4.2
# Vraag de gebruiker om hun leeftijd
$leeftijd = Read-Host "Voer uw leeftijd in"
# Controleer of de invoer een getal is
if ([int]::TryParse($leeftijd, [ref]$null)) {
$leeftijd = [int]$leeftijd
4.2
# Definieer de variabele x
$x = 30 # Bijvoorbeeld 30 dagen
# Pad naar de map met de bestanden
$folderPath = "C:\data1"
4.4
# Definieer de variabele x
$x = 30 # Bijvoorbeeld 30 dagen
# Pad naar de map met de bestanden
$folderPath = "C:\data1"