This demonstrates how to prompt for a choice in a loop.
$the_data = @("a1", "b2", "c3", "d4")
## The following four lines only need to be declared once in your script.
$yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes","Description."
$no = New-Object System.Management.Automation.Host.ChoiceDescription "&No","Description."
$cancel = New-Object System.Management.Automation.Host.ChoiceDescription "&Cancel","Description."
$all = New-Object System.Management.Automation.Host.ChoiceDescription "&All", "Description."
$options = [System.Management.Automation.Host.ChoiceDescription[]]($yes, $no, $all, $cancel)
$last_choice = -1
foreach ($d in $the_data)
{
if ($last_choice -ne 2)
{
$title = "Processing Registy"
$message = ("Do you want to delete: $d")
$last_choice = $host.ui.PromptForChoice($title, $message, $options, 0)
}
if ($last_choice -eq 1)
{
continue
}
elseif ($last_choice -eq 3)
{
break
}
"Deleting: $d"
}
## Use the following each time your want to prompt the use
# $title = "Title"; $message = "Question?"
# $result = $host.ui.PromptForChoice($title, $message, $options, 0)
# switch ($result) {
# 0{
# Write-Host "Yes"
# }1{
# Write-Host "No"
# }2{
# Write-Host "Cancel"
# }
# }
can i have that goto?
Wednesday, January 16, 2019
Saturday, July 24, 2010
Load a Document from a Sharepoint DocumentLibrary
Load a Document from a Sharepoint DocumentLibrary: "- Sent using Google Toolbar"
Wednesday, November 4, 2009
Linux Network Managers
Saw a comment on slashdot that WICD is better for wireless than NetworkManager. I'll have to check it out.
Thursday, September 24, 2009
Friday, August 7, 2009
Friday, April 4, 2008
Friday, December 28, 2007
Some X11 settings...
Not for your enjoyment, but for my own record:
Section "Monitor"
Identifier "DELL D1025TM"
Option "DPMS"
VertRefresh 50-120
HorizSync 30-85
EndSection
Ubuntu leaves out the VertRefresh and HorizSync attributes.
Section "Monitor"
Identifier "DELL D1025TM"
Option "DPMS"
VertRefresh 50-120
HorizSync 30-85
EndSection
Ubuntu leaves out the VertRefresh and HorizSync attributes.
Subscribe to:
Posts (Atom)