关闭显示器的脚本

一、用BAT脚本关闭显示器

shutdown_monitor.bat

%windir%\System32\scrnsave.scr /s

二、用BAT调PowerShell脚本关闭显示器

RunPowerShellScript.bat

@echo off

powershell -NoProfile -ExecutionPolicy Bypass -File "TurnOffMonitor.ps1"

pause

TurnOffMonitor.ps1

Add-Type '[DllImport("user32.dll")]public static extern int SendMessage(int hWnd, int hMsg, int wParam, int lParam);' -Name a -Namespace b

b.a\]::SendMessage(-1, 0x0112, 0xF170, 2) Write-Host "The monitor is now turned off." -ForegroundColor Green 效果: 显示器会黑屏,移动鼠标或键盘会恢复。 ![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/63746583b2a942d0bf03aea2e160d9c5.png)

相关推荐
剁椒排骨14 小时前
win11什么都不动之后一段时间黑屏桌面无法显示,但鼠标仍可移动,得要熄屏之后才能进入的四种解决方法
运维·windows·经验分享·计算机外设·win11·win10
iFlyCai17 小时前
对Mac文字双击或三击鼠标左键没有任何反应
macos·计算机外设
伊织code18 小时前
BongoCat - 跨平台键盘猫动画工具
计算机外设·动画·键盘·bongocat
m0_738355691 天前
护眼-科学使用显示器
计算机外设
xiaowu0802 天前
C# 使用Windows API实现键盘钩子的类
windows·c#·计算机外设
成工小白3 天前
【Linux】冯诺依曼体系结构及操作系统架构图的具体剖析
linux·计算机外设
transformer_WSZ4 天前
赛睿鼠标设置宏
计算机外设
活跃家族4 天前
UI键盘操作
ui·计算机外设
啊丢_4 天前
配置tmux ctrl+a与鼠标点击切换
计算机外设
是Dream呀5 天前
AI写代码时代,我却被这块28寸方屏显示器圈了粉!
人工智能·计算机外设·明基