PowerShe 消息提示框測試

1. 使用powerShell 彈出一個簡單的消息框,代碼以下,建立test.ps1腳本文件。bash

$ConfirmPreference = 'None'
$ws = New-Object -ComObject WScript.Shell
$wsr = $ws.popup("The software has installed successfully, please restart your computer to take effect. Press OK to restart later.",0,"Reboot Attention!",0 + 64) 

執行test1.ps1後,電腦右下角會彈出該消息提示框。rest

2. 使用VM腳原本提示用戶重啓電腦,保存腳本爲test.bvs, 運行後就能夠看到彈出提示框,點yes時,電腦會自動重啓:blog

Dim return 
Set R = CreateObject("WScript.Shell") 
return=MsgBox ("A new software has been installed on your computer, Please restart to take effect.Click OK to restart now, click Cancel to restart later",vbokcancel+vbexclamation,"Attention!") 
If return=vbok Then 
R.run("Shutdown.exe -r -t 60") 
End if
相關文章
相關標籤/搜索