Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $a = ('*.bat','*.txt')
- $b = Get-ChildItem $a
- Function deleteFiles {
- $title = "Delete Files"
- $message = "Do you want to delete the files in the folder?"
- $yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes", `
- "Deletes all files in the folder."
- $no = New-Object system.Management.Automation.Host.ChoiceDescription "&No", `
- "Don't delete the files in the folder."
- $options = [System.Management.Automation.Host.ChoiceDescription[]] ($yes,$no)
- $result = $Host.UI.PromptForChoice($title, $message, $options, 0)
- switch ($result) {
- 0 {Write-Host "Hot Damn!"}
- 1 {Write-Host "Darn!"}
- }
- }
- if($b){deleteFiles}
- else {Write-Host "Nope...Nothing there"}
Add Comment
Please, Sign In to add comment