- Add-Type -AssemblyName System.Windows.Forms
-
- $Column1 = @{ expression = "Name"; width = 50; label = "服务名"; alignment = "right" }
- $Column2 = @{ expression = "DisPlayname"; width = 50; label = "显示名"; alignment = "left" }
- $html = Get-Service | ConvertTo-Html -property name,DisPlayname
- $html=$html -replace '(?<=<tr><td)(?=>)',' style="text-align:right;"'
-
- $webbrowser1 = New-Object 'System.Windows.Forms.WebBrowser'
- $webbrowser1.Dock = 'Fill'
- $webbrowser1.DocumentText = $html
-
- $form1 = New-Object 'System.Windows.Forms.Form'
- $form1.ClientSize = '600, 460'
- $form1.StartPosition = 'CenterScreen'
- $form1.Text = 'IE浏览器'
- $form1.Controls.Add($webbrowser1)
-
- $form1.ShowDialog()
复制代码
|