Powershell:如果用户在Toast消息中按下按钮,则继续脚本

Powershell:如果用户在Toast消息中按下按钮,则继续脚本,powershell,button,toast,confirmation,Powershell,Button,Toast,Confirmation,如果用户通过Toast消息中的“是”按钮确认,我正在寻找继续Powershell脚本的选项(此项目中不允许使用Windows.Forms)。 我该怎么做 这是到目前为止我所拥有的示例代码: $null = [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] $null = [Windows.Data.Xml.Dom.XmlDocume

如果用户通过Toast消息中的“是”按钮确认,我正在寻找继续Powershell脚本的选项(此项目中不允许使用Windows.Forms)。 我该怎么做

这是到目前为止我所拥有的示例代码:

$null = [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime]
$null = [Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime]

$XmlString = @"
  <toast launch = "Test1" scenario='alarm'>
    <visual>
      <binding template="ToastGeneric">
        <text>Title</text>
        <text>Message</text>
      </binding>
    </visual>
    <audio src="ms-winsoundevent:Notification.Looping.Alarm" />
    <actions>
        <action content="yes" arguments="yes" activationType="foreground" />
        <action content="no" arguments="no" activationType="foreground" />
    </actions>
  </toast>
"@

$AppId = '{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\WindowsPowerShell\v1.0\powershell.exe'
$ToastXml = [Windows.Data.Xml.Dom.XmlDocument]::new()
$ToastXml.LoadXml($XmlString)
$Toast = [Windows.UI.Notifications.ToastNotification]::new($ToastXml)
$null  = [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($AppId).Show($Toast)
$null=[Windows.UI.Notifications.ToastNotificationManager,Windows.UI.Notifications,ContentType=WindowsRuntime]
$null=[Windows.Data.Xml.Dom.XmlDocument,Windows.Data.Xml.Dom.XmlDocument,ContentType=WindowsRuntime]
$XmlString=@”
标题
消息
"@
$AppId='{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\WindowsPowerShell\v1.0\powershell.exe'
$ToastXml=[Windows.Data.Xml.Dom.XmlDocument]::new()
$ToastXml.LoadXml($XmlString)
$Toast=[Windows.UI.Notifications.ToastNotification]::新建($ToastXml)
$null=[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($AppId).Show($Toast)