欢迎来到好人卡资源网,专注网络技术资源收集,我们不仅是网络资源的搬运工,也生产原创资源。寻找资源请留言

电脑一键熄屏+休眠bat文件

hacker sky995 12个月前 (10-02) 626次浏览 0个评论

许多时候我们有事外出或者长时间不用电脑,但是又不能关机的情况下,如何省电呢?

电脑屏幕基本上市电脑最费电的一部分了,设置的屏保需要等待几分钟乃至半个小时才能息屏。

并且一般我们都不知道如何休眠电脑,一不小心按错了就直接关机了。

这里分享几个一键息屏+休眠的代码,大家自己编辑成bat即可直接使用了。

使用方法:
方法1+2都是新建文本,教程如下:(文件都打包了,大家下载页面下载即可。)

右键桌面新建文本文档并打开,粘贴代码,点击另存为,把下边的UTF-8改为ANSI,

文件类型改为所有文件,文件名称输入(熄屏.bat),保存over。

代码一、息屏+锁屏如下:

<span class="lit">@echo</span><span class="pln"> off
echo </span><span class="lit">2</span><span class="pun">秒钟后自动熄灭屏幕</span> 
 
<span class="pun">::</span><span class="lit">3</span><span class="pun">秒延时</span><span class="pln">
ping </span><span class="pun">-</span><span class="pln">n </span><span class="lit">3</span> <span class="lit">127.1</span> <span class="pun">></span><span class="pln">nul
 

</span><span class="pun">::息屏+休眠</span><span class="pln">
 
start  C</span><span class="pun">:</span><span class="pln">\Windows\System32\rundll32</span><span class="pun">.</span><span class="pln">exe powrprof</span><span class="pun">.</span><span class="pln">dll</span><span class="pun">,</span><span class="typ">SetSuspendState</span> <span class="typ">Hibemate</span>

如上的3数字是2秒后自动熄屏的代码,

可以自己更改

2秒后自动熄灭屏幕这里的文字也可以自己修改

喜欢二次元的可以加一些炫酷图案颜文字进去

代码二,息屏不锁屏:

<span class="lit">@echo</span><span class="pln"> off
echo </span><span class="lit">3</span><span class="pun">秒钟后自动熄灭屏幕</span>  <span class="pun">并</span> <span class="pun">不锁屏</span>
 
 
<span class="pun">::</span><span class="lit">3</span><span class="pun">秒延时</span><span class="pln">
ping </span><span class="pun">-</span><span class="pln">n </span><span class="lit">4</span> <span class="lit">127.1</span> <span class="pun">></span><span class="pln">nul
 
 
 
</span><span class="pun">::息屏</span><span class="pln">
powershell </span><span class="pun">(</span><span class="typ">Add</span><span class="pun">-</span><span class="typ">Type</span> <span class="str">'[DllImport(\"user32.dll\")]^public static extern int SendMessage(int hWnd, int hMsg, int wParam, int lParam);'</span> <span class="pun">-</span><span class="typ">Name</span><span class="pln"> a </span><span class="pun">-</span><span class="typ">Pas</span><span class="pun">)::</span><span class="typ">SendMessage</span><span class="pun">(-</span><span class="lit">1</span><span class="pun">,</span><span class="lit">0x0112</span><span class="pun">,</span><span class="lit">0xF170</span><span class="pun">,</span><span class="lit">2</span><span class="pun">)</span>
 
<span class="kwd">exit</span>

代码三,创建快捷方式,可以立马响应,无需等待:

1,复制如下代码:

<span class="pln">C</span><span class="pun">:</span><span class="pln">\Windows\System32\rundll32</span><span class="pun">.</span><span class="pln">exe powrprof</span><span class="pun">.</span><span class="pln">dll</span><span class="pun">,</span><span class="typ">SetSuspendState</span> <span class="typ">Hibemate</span>

将代码覆盖进快捷方式里的<目标>编辑框。

四、只关闭屏幕

代码如下创建bat文件即可:

<span class="pln">powershell </span><span class="pun">(</span><span class="typ">Add</span><span class="pun">-</span><span class="typ">Type</span> <span class="str">'[DllImport(\"user32.dll\")]^public static extern int SendMessage(int hWnd, int hMsg, int wParam, int lParam);'</span> <span class="pun">-</span><span class="typ">Name</span><span class="pln"> a </span><span class="pun">-</span><span class="typ">Pas</span><span class="pun">)::</span><span class="typ">SendMessage</span><span class="pun">(-</span><span class="lit">1</span><span class="pun">,</span><span class="lit">0x0112</span><span class="pun">,</span><span class="lit">0xF170</span><span class="pun">,</span><span class="lit">2</span><span class="pun">)</span>

 


好人卡资源网 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:电脑一键熄屏+休眠bat文件
喜欢 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址