Read-Host (Yes or No)

PHOTO EMBED

Wed Dec 28 2022 01:32:43 GMT+0000 (Coordinated Universal Time)

Saved by @savabeh191

# Ask for confirmation
Write-host "Creating $amount test files in $path" -ForegroundColor Cyan
$reply = Read-Host -Prompt "Is this correct? [Y] Yes [N] No "

# Check the reply and create the files:
if ( $reply -match "[yY]" ) { 
    # Create files
    1..10 | ForEach-Object {
      $newFile = "$path\test_file_$_.txt";
      New-Item $newFile
    }
}
content_copyCOPY

https://lazyadmin.nl/powershell/powershell-script/