你知道怎么用powershell关闭显示器,且使得点击鼠标和键盘时屏幕依然保持关闭吗,不要禁用鼠标和键盘
时间: 2024-02-16 19:59:54 浏览: 37
在 PowerShell 中关闭显示器,同时使得点击鼠标和键盘时屏幕依然保持关闭,可以使用以下命令:
```powershell
Add-Type -TypeDefinition @"
using System;
using System.Runtime.InteropServices;
public class User32 {
[DllImport("user32.dll")]
public static extern int SendMessage(int hWnd, int hMsg, int wParam, int lParam);
}
"@
[User32]::SendMessage(-1, 0x0112, 0xF170, 2)
```
这将使用 `SendMessage` 函数向计算机发送关闭显示器的命令。当屏幕关闭时,点击鼠标和键盘不会唤醒屏幕,而是保持关闭状态。如果您想要重新打开屏幕,请按任意键或移动鼠标。
相关问题
你知道怎么用powershell关闭显示器,且使得点击鼠标时屏幕依然保持关闭吗,不要禁用鼠标
在 PowerShell 中关闭显示器并保持点击鼠标时屏幕关闭的方法是将电脑休眠,这需要修改计算机的电源选项。可以使用以下 PowerShell 命令将计算机设置为休眠模式:
```powershell
Set-SleepConfiguration -SleepType Hibernate
```
这将在计算机空闲一段时间后将其置于休眠模式。在休眠模式下,电脑的所有活动都将停止,包括显示器,但是当鼠标点击时电脑不会唤醒。如果您想要唤醒电脑,请按任意键。
你知道怎么用cmd关闭显示器,且使得点击鼠标和键盘时屏幕依然保持关闭吗,不要禁用鼠标和键盘,不要让电脑休眠
在 CMD 中关闭显示器,同时使得点击鼠标和键盘时屏幕依然保持关闭,可以使用以下命令:
```cmd
powershell (Add-Type '[DllImport(\"user32.dll\")]public static extern int SendMessage(int hWnd, int hMsg, int wParam, int lParam);' -Name a -Pas)::SendMessage(-1,0x0112,0xF170,2)
```
这将使用 PowerShell 的 `SendMessage` 函数向计算机发送关闭显示器的命令。当屏幕关闭时,点击鼠标和键盘不会唤醒屏幕,而是保持关闭状态。如果您想要重新打开屏幕,请按任意键或移动鼠标。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)