关闭显示器的脚本

一、用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)

相关推荐
jmu-pfm1 天前
联想拯救者Y7000P遇到键盘失灵USB接口失效问题
计算机外设
斌蔚司李1 天前
外接显示器无法使用键盘/鼠标问题解决
计算机外设
电脑小管家1 天前
DirectX报错怎么办?快速修复游戏和软件崩溃问题
windows·驱动开发·microsoft·计算机外设·电脑
极客先躯1 天前
如何修复 ECharts 鼠标交互(如 hover、点击)位置错位的问题
计算机外设·echarts·交互
uuleaf2 天前
打字速度练习:零基础14天提升到80CPM键盘打字指南
计算机外设
TESmart碲视2 天前
TESmart 推出全新 DP 1.4 双 8K@60Hz KVM 切换游戏扩展坞,助力专业与游戏工作流高效整合
游戏·计算机外设·音视频·kvm切换器·tesmart
tealcwu2 天前
【Unity踩坑】Simulate Touch Input From Mouse or Pen 导致检测不到鼠标点击和滚轮
unity·计算机外设·游戏引擎
SamtecChina20233 天前
Samtec小课堂| 电气设计中电缆组件的注意事项
大数据·数据仓库·人工智能·汽车·计算机外设
我送炭你添花3 天前
Pelco KBD300A 模拟器:TEST02.重构后键盘部分的测试操作一步一步详细指导
python·重构·自动化·计算机外设·运维开发