2013-01-23 86 views
-1

我將要求最終用戶在Outlook中使用 Outlook.exe /CleanAutoCompleteCache命令清理緩存地址。 我可以創建一個批處理文件並要求他們點擊它。它可以工作,但在繼續之前,他們應該會彈出提醒,警告運行此文件會從緩存中刪除所有地址。Pop up For Alert

+0

Sry,但我不明白你的問題?你究竟想做什麼? – Kooki

+1

你應該描述你的問題,比如你正在使用哪種編程語言或者計劃以及你如何去做這件事?請說明你的問題? – erhun

+1

你的人是什麼?他有一個執行'Outlook.exe/CleanAutoCompleteCache'的批處理文件。在這之前,他想問用戶他是否真的想要運行命令。如果你不能理解它,不要把它放在OP上。 – vanneto

回答

0

在PowerShell中,您可以創建自定義的確認對話框,shown here:如果你需要一個messagebox你可以將它添加到你的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 
    } 
} 
1

:所以在這裏

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.. 
} 
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 
} 

閱讀HERE

+0

感謝所有的答覆,我需要從警報彈出消息的客戶端Outlook中運行此命令。您所提出的建議都將在PowerShell中運行。但它不適用於客戶端前景。 –