- 积分
- 206
- 最后登录
- 2024-6-18
- 精华
- 0
- 阅读权限
- 30
- 主题
- 8
- UID
- 127634
- 帖子
- 441
- PB币
- 336
- 威望
- 5
- 贡献
- 0
- 技术
- 0
- 活跃
- 1693
![Rank: 5](https://bbs.pcbeta.com//static/image/pcbeta//star_level2.gif) ![Rank: 5](https://bbs.pcbeta.com//static/image/pcbeta//star_level1.gif) ![Rank: 5](https://bbs.pcbeta.com//static/image/pcbeta//star_level1.gif)
- UID
- 127634
- 帖子
- 441
- PB币
- 336
- 贡献
- 0
- 技术
- 0
- 活跃
- 1693
|
76F
发表于 2022-1-12 18:00:08
IP属地辽宁
|只看该作者
本帖最后由 workholly 于 2022-1-12 18:30 编辑
PowerShell,打开并最大化、前置---------------------------------------------------------------------------------------------------------------------
#Requires -Version 5
$ie = New-Object -COMObject InternetExplorer.Application
$ie.visible = $true
$ie.Navigate("https://www.baidu.com")
$sw = @'
[DllImport("user32.dll")]
public static extern int ShowWindow(int hwnd, int nCmdShow);
[DllImport("user32.dll")]
public static extern int SetForegroundWindow(IntPtr hWnd);
'@
$type = Add-Type -Name ShowWindow2 -MemberDefinition $sw -Language CSharp -Namespace Utils -PassThru
$type::ShowWindow($ie.hwnd, 3) # 3 = maximize
$type::SetForegroundWindow($ie.hwnd)
---------------------------------------------------------------------------------------------------------------------
|
|