-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.ps1
25 lines (25 loc) · 825 Bytes
/
test.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.MessageBox]::Show('System.Windows.Forms.MessageBox')
Add-Type -AssemblyName System.Windows.Forms
$dialogResult = [System.Windows.Forms.MessageBox]::Show('System.Windows.Forms.MessageBox', 'confirm', 'YesNo')
if($dialogResult -eq 'Yes'){
Write-Host 'yes'
} else {
Write-Host 'no'
}
$notifyIcon = New-Object System.Windows.Forms.NotifyIcon
$notifyIcon.Icon = [System.Drawing.SystemIcons]::Information
$notifyIcon.Text = "notifyIcon.Text"
$notifyIcon.Visible = $true
$notifyIcon_MouseMove = {
# $time = Get-Date -Format 'HH:mm:ss'
$time = Get-Date
$notifyIcon.Text = "time:$time"
}
$notifyIcon.add_MouseMove($notifyIcon_MouseMove)
# 阻止脚本退出
while ($true) {
Start-Sleep -Milliseconds 1000
}
# 清理资源
$notifyIcon.Dispose()