-1

Outlook.exe /CleanAutoCompleteCacheOutlook のコマンドを使用して、エンド ユーザーにキャッシュ アドレスを消去するよう依頼します 。バッチ ファイルを作成し、それをクリックするように依頼することができます。これは機能しますが、先に進む前に、このファイルを実行するとキャッシュからすべてのアドレスが削除されるというポップアップ アラートが表示されます。

4

3 に答える 3

1

必要なmessagebox場合は、これを powershell スクリプトに追加できます。

Add-Type -AssemblyName System.Windows.Forms 
$result = [System.Windows.Forms.MessageBox]::Show("if you run this file it will delete all addresses from your cache","Warning", 4)
if ($result -eq "Yes" )
{
  ...do work...
}
else
{
 ..do some other stuff..
}
于 2013-01-23T10:59:05.390 に答える
0

PowerShell では、次のようにカスタム確認ダイアログを作成できます。

param([string]$title="Confirm",[string]$message="Are you sure?")
$choiceYes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes", "Answer Yes."
$choiceNo = New-Object System.Management.Automation.Host.ChoiceDescription "&No", "Answer No."
$options = [System.Management.Automation.Host.ChoiceDescription[]]($choiceYes, $choiceNo)
$result = $host.ui.PromptForChoice($title, $message, $options, 1)
switch ($result)
{
    0 
    {
        Return $true
    }

    1 
    {
        Return $false
    }
}
于 2013-01-23T10:55:33.067 に答える
0

だからここに小さなpowershellスクリプトがあります:

$a = new-object -comobject wscript.shell 
$intAnswer = $a.popup("INFORM USER HERE", 0,"WARNING",1) 
If ($intAnswer -eq 6)
{ 
    //USER OK
} 
else 
{ 
    //USER CANCEL
} 

ここを読む

于 2013-01-23T11:04:22.050 に答える