关闭显示器的脚本

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

效果:

显示器会黑屏,移动鼠标或键盘会恢复。

相关推荐
忆~遂愿13 小时前
免密连接+快捷键+虚拟鼠标:ToDesk远程操作AI效率拉满
人工智能·python·深度学习·神经网络·自然语言处理·计算机外设·安全架构
硅基手札13 小时前
【串口技术系列文档 07】UART控制器寄存器详解
驱动开发·stm32·单片机·嵌入式硬件·mcu·计算机外设
硅基手札13 小时前
【串口技术系列文档 09】FIFO管理与流控
驱动开发·stm32·单片机·嵌入式硬件·mcu·计算机外设
硅基手札13 小时前
【串口技术系列文档 08】中断驱动vs轮询vs DMA
驱动开发·stm32·单片机·嵌入式硬件·mcu·计算机外设
承渊政道16 小时前
鸿蒙设备远控电脑实测:ToDesk蓝牙键鼠、双模式鼠标、跨端剪贴板,远控电脑更顺手了
计算机外设·电脑·harmonyos·远程工作·todesk
ji_shuke2 天前
使用 Canvas 和 mix-blend-mode 实现跟随鼠标的反色圆圈
microsoft·计算机外设·canvas
硅基手札2 天前
【串口技术系列文档 04】UART协议深度解析
驱动开发·stm32·单片机·嵌入式硬件·mcu·计算机外设
开开心心_Every2 天前
电脑OCR识别软件支持表格识别图片转Excel
java·开发语言·微信·计算机外设·ocr·intellij-idea·excel
野蛮人6号3 天前
macbook连上外接显示器后,字体变小,如何设置成像原来本机的界面一样呢?
计算机外设
打工仔折腾 AI3 天前
从零写一个CAD 05:以鼠标为中心的滚轮缩放,招法能复用但顺序不能反
开发语言·后端·python·性能优化·计算机外设·swift·ai agent 实战