powershell - Powershell 脚本问题
问题描述
我想弹出在 powershell 中执行的输出这是我的 powershell 的示例输出
在图片中,您可以看到“GetDirectories is not reconized”错误。
如果错误条件在 powershell 输出中匹配意味着我想弹出一个显示错误“GetDirectories is not reconized”
请建议powershell脚本。
解决方案
Try {
GetDirectories -ErrorAction Stop
}
Catch {
Add-Type -AssemblyName PresentationCore,PresentationFramework
$ButtonType = [System.Windows.MessageBoxButton]::OK
$MessageboxTitle = "Test pop-up message title"
$Messageboxbody = "GetDirectories is not reconized"
$MessageIcon = [System.Windows.MessageBoxImage]::Warning
[System.Windows.MessageBox]::Show($Messageboxbody,$MessageboxTitle,$ButtonType,$messageicon)
}
推荐阅读
- sql - 正则表达式提取(字符串的左侧部分来自 1 之前的 1 个下划线)
- sql - 如何将 Mysqli NESTED JOIN 查询转换为活动记录
- javascript - socket io 事件触发多次
- reactjs - 基本身份验证登录弹出窗口未显示
- performance - 如何解决“Admob 离线性能问题”?
- c# - 尝试从 QBO API 获取超过 1000 个客户和发票时出现异常
- sql - 填补表格中缺失的天数
- python - 如何在字典理解中创建某些值的元组?
- unity3d - Unity 3D - 无法签署 APK - 虽然我提供了正确的密钥库和密码
- python - 从 obj+mtl 文件中命令行渲染一批 PNG 图像