Windows の PowerShellから、強制再起動
PS> Restart-Computer -Force
-Force
を指定することで、確認ダイアログなどを出さずに、容赦なく再起動。
Windows の PowerShellから、強制再起動
PS> Restart-Computer -Force
-Force
を指定することで、確認ダイアログなどを出さずに、容赦なく再起動。
Windows の PowerShellから、マルチスクリーンの解像度を取得する方法。
PS> Add-Type -AssemblyName System.Windows.Forms PS> [System.Windows.Forms.Screen]::AllScreens BitsPerPixel : 32 Bounds : {X=0,Y=0,Width=2560,Height=1440} DeviceName : \\.\DISPLAY1 Primary : True WorkingArea : {X=0,Y=0,Width=2560,Height=1400} BitsPerPixel : 32 Bounds : {X=2560,Y=0,Width=1344,Height=840} DeviceName : \\.\DISPLAY2 Primary : False WorkingArea : {X=2560,Y=0,Width=1344,Height=800}
Add-Type -AssemblyName System.Windows.Forms
で、PowerShell以外のAPIにアクセスできるようにして、WPFのライブラリを叩けるようにするのが肝。
Via! https://stackoverflow.com/questions/7967699/get-screen-resolution-using-wmi-powershell-in-windows-7