本帖最后由 idwma 于 2022-4-10 20:37 编辑
再绕一下- #@&cls&powershell "type '%~0'|out-string|iex"&pause&exit
- [console]::BufferHeight=[console]::WindowHeight
- [console]::BufferWidth=[console]::WindowWidth
- Add-Type -Ty @'
- using System.Runtime.InteropServices;
- public static class WinApi{
- [DllImport("kernel32.dll")] public static extern uint GetConsoleWindow();
- [DllImport("User32.dll")] public static extern int SetWindowLong(uint hWnd,int nIndex,int dwNewLong);
- [DllImport("User32.dll")] public static extern bool SetWindowPos(uint hWnd,uint hAfter,uint x,uint y,uint cx,uint cy,uint flags);
- }
- '@
- $l=(Get-WmiObject win32_videocontroller).CurrentHorizontalResolution/2-200
- $a=[WinApi]::GetConsoleWindow()
- [void][WinApi]::SetWindowLong($a, -16, 369164288)
- [WinApi]::SetWindowPos($a,0,$l,0,0,0,1)
- [WinApi]::SetWindowPos($a,0,$l,0,400,500,2)
- [console]::BufferHeight=[console]::WindowHeight
- [console]::BufferWidth=[console]::WindowWidth
复制代码
|