vb唤醒计算机_如何防止计算机意外唤醒

vb唤醒计算机

vb唤醒计算机

wpw_top

Putting your PC to sleep is a great way to save energy while still making sure you can resume work quickly. But what can you do if your PC keeps waking up on its own? Here’s how to figure out what’s waking it up, and how to prevent it.

使PC进入睡眠状态是节省能源的绝佳方法,同时仍可确保您可以快速恢复工作。 但是,如果您的PC不断自行唤醒,该怎么办? 这是找出问题的起因以及如何预防的方法。

When you put your PC to sleep, it enters a power-saving state where it shuts down power to most of the PC’s components, keeping just enough power trickling to keep the memory refreshed. This lets you quickly wake the computer back up to the same state it was in when it went to sleep—including any documents and folders you had open. One of the differences between sleep and hibernation is that when a PC is alseep, activity from certain devices can wake it up. Scheduled tasks can also be configured to wake the PC up so that they can run.

当您将PC置于睡眠状态时 ,它会进入省电状态,在此状态下,它将关闭PC大部分组件的电源,仅保留足够的电源滴流以保持内存刷新。 这使您可以快速将计算机恢复到睡眠状态,包括您打开的所有文档和文件夹。 睡眠和Hibernate之间区别之一是,当PC处于侦听状态时,某些设备的活动可以将其唤醒。 计划任务也可以配置为唤醒PC,以便它们可以运行。

如何找出什么正在唤醒您的PC (How to Find Out What’s Waking Your PC Up)

Before you can fix the problem, you need to determine the problem. There are a few different steps you’ll probably need to take here, as no one solution fits everyone.

在解决问题之前,您需要确定问题。 您可能需要在这里采取一些不同的步骤,因为没有一种解决方案适合所有人。

查看唤醒电脑的最后一件事 (See the Last Thing That Woke Your PC)

The first step in figuring out why your PC is waking up before you want it to is determining what’s doing the waking. You can usually figure out what event caused your computer to wake up most recently with a simple Command Prompt command. Start the Command Prompt by hitting Start, typing “command,” and then selecting the “Command Prompt” app.

弄清楚PC为何要醒来之前的第一步是确定正在做什么。 通常,您可以使用简单的命令提示符命令来找出是什么原因导致计算机最近一次唤醒。 通过单击“开始”,键入“ command”,然后选择“ Command Prompt”应用程序来启动命令提示符。

wpw_1

In the Command Prompt window, type the following command and press Enter:

在“命令提示符”窗口中,键入以下命令,然后按Enter:

powercfg -lastwake
wpw_2

I can tell from the output of the command above, for example, that I used the power button to wake my PC. You may also see listed devices—like your mouse, keyboard, or network adapter—or events like wake timers or automatic maintenance.

例如,从上面命令的输出中可以看出,我使用电源按钮唤醒了PC。 您可能还会看到列出的设备(例如鼠标,键盘或网络适配器)或事件(例如唤醒计时器或自动维护)。

This won’t always give you the information you need, but often it will.

这不会总是为您提供所需的信息,但是通常会。

使用事件查看器探索其他唤醒事件 (Explore Other Wake Up Events with Event Viewer)

While the Command Prompt command we just talked about is great for showing you what last woke your PC, sometimes you need to go a bit further back in history to see what’s woken it up before. For that, we’ll turn to Event Viewer, a handy logging tool that will help us see when your computer turned off (be that because it was shut down, put to sleep, or hibernated) and when it woke up.

虽然我们刚才讨论的命令提示符命令非常适合向您显示上一次唤醒您的PC的内容,但有时您需要回顾一下历史,以了解之前的操作。 为此,我们将使用Event Viewer ,这是一个方便的日志记录工具,它将帮助我们查看您的计算机何时关闭(因为它已关闭,进入睡眠或Hibernate状态)以及何时醒来。

To open Event Viewer, hit Start, type “event,” and then select “Event Viewer.”

要打开事件查看器,请单击开始,键入“事件”,然后选择“事件查看器”。

wpw_3

In the left-hand pane, drill down to Event Viewer (Local) > Windows Logs > System. You’ll see a lot of information here, but don’t worry. You don’t need to read through or attempt to understand everything going on in the log. We’re going to filter it to just the stuff we need to look at. Right-click the “System” log and choose “Filter Current Log.”

在左侧窗格中,深入到“事件查看器(本地)”>“ Windows日志”>“系统”。 您会在这里看到很多信息,但是请放心。 您无需通读或尝试了解日志中发生的所有事情。 我们将其过滤为仅需要查看的内容。 右键单击“系统”日志,然后选择“过滤当前日志”。

wpw_4

In the Filter Current Log window, on the “Event sources” drop-down menu, select the “Power-Troubleshooter” option and then click “OK.”

在“筛选当前日志”窗口的“事件源”下拉菜单上,选择“电源疑难解答”选项,然后单击“确定”。

wpw_5

Back in the main Event Viewer window, you’ll see that we’ve filtered out the hundreds of messages that aren’t relevant to our problem and honed right in on the thing we care about: when the computer is waking up from a low-power state. In the new filtered view, you can scroll through every instance where your computer has woken over the duration of the log (which should be hundreds of entries).

返回“事件查看器”主窗口,您会看到我们过滤掉了数百条与问题无关的消息,并仔细研究了我们关心的事情:当计算机从低位唤醒时-电源状态。 在新的筛选视图中,您可以滚动浏览日志持续时间内计算机唤醒的每个实例(应该是数百个条目)。

wpw_6

What you should focus on is the time the event was logged (did it wake at a time you were at the computer or was it a random middle-of-the-night wake up call) and what Wake Source is indicated.

您应该关注的是事件被记录的时间(在您坐在计算机上时是醒来的,还是随机的半夜醒来的电话),并指出了唤醒源。

  • If the Wake Source says “Power Button,” that indicates that the power button on the PC was pressed to wake it up—an action you most likely took yourself.

    如果“唤醒源”显示为“电源按钮”,则表示已按下PC上的电源按钮将其唤醒,您很可能已采取了这种行动。
  • If the Wake Source says something like “Device–HID-Compliant Mouse (or Keyboard),” that indicates the PC is configured for key presses and mouse movements to wake it.

    如果唤醒源显示类似“设备-HID兼容的鼠标(或键盘)”的字样,则表明PC已配置为可以通过按键和鼠标移动来唤醒它。
  • If the Wake Source lists your network adapter, that indicates your PC is configured so that incoming network activity can wake it up—something that’s useful if you like having your PC go to sleep but still need it available to other network devices at times.

    如果“唤醒源”列出了您的网络适配器,则表明您的PC已配置为可以使传入的网络活动将其唤醒-如果您希望让PC进入睡眠状态,但有时仍需要其他网络设备使用它,则这很有用。

  • If the Wake Source says “Timer,” it means that a scheduled task woke the computer. The source information usually includes some indication about the task that woke the PC. For example, in the previous screenshot, I can tell that my PC was woken up in order to do a scheduled restart after an update.

    如果唤醒源显示“计时器”,则意味着计划的任务唤醒了计算机。 源信息通常包括一些有关唤醒PC的任务的指示。 例如,在上一个屏幕截图中,我可以说我的PC已被唤醒,以便在更新后进行计划的重新启动。
  • You may also see something like “Wake Source: Unknown,” which is a bit more cryptic but at least it tells when the PC was awoken.

    您可能还会看到类似“唤醒源:未知”之类的信息,它有点神秘,但至少可以告诉您何时唤醒了PC。

Once you’ve established that there is in fact a pattern of odd computer wake up calls and you’ve identified the source, it’s time to do something about it.

一旦确定了实际上有一种奇怪的计算机唤醒呼叫模式,并且已经确定了来源,就该采取措施了。

如何阻止您的PC随机唤醒 (How to Stop Your PC From Waking Up Randomly)

Hopefully, one of the above tricks helped you figure out what’s waking your PC. Now, it’s time to solve the problem. Skip down to the section that applies to your situation.

希望上述技巧之一可以帮助您弄清PC的唤醒方式。 现在,该解决问题了。 跳至适用于您情况的部分。

限制可以唤醒PC的硬件设备 (Limit Hardware Devices That Can Wake Your PC)

As you probably noticed from looking through Event Viewer logs, there are four primary hardware devices that can wake your PC: mice, keyboards, network adapters, and power buttons (or laptop lids if that’s what you’re using). You can easily view a complete list of the hardware devices allowed to wake your PC with a Command Prompt command. Open up a Command Prompt window and run the following command:

从事件查看器日志中可能会发现,有四种可以唤醒PC的主要硬件设备:鼠标,键盘,网络适配器和电源按钮(如果您使用的是笔记本电脑盖)。 您可以使用命令提示符命令轻松查看允许唤醒PC的硬件设备的完整列表。 打开命令提示符窗口,然后运行以下命令:

powercfg -devicequery wake_armed
wpw_7

In this example, I’ve got several devices that are allowed to wake my PC, including an Intel Ethernet adapter, two keyboards (I switch between regular and gaming keyboards), and a mouse. Whatever your setup, now that you know what devices can wake your PC, you can head over to Device Manager to tell them not to.

在此示例中,我有几种允许唤醒PC的设备,包括Intel以太网适配器,两个键盘(我在常规和游戏键盘之间切换)和鼠标。 无论您进行什么设置,现在您都知道可以唤醒PC的设备,因此可以转到Device Manager告诉他们不要。

We’ve covered in detail how to prevent your mouse from waking your PC and how to prevent network activity from waking your PC. So, in our example here, we’ll be preventing the keyboard from waking the PC. Why would you want to do this? One word: cats.

我们已经详细介绍了如何防止鼠标唤醒计算机以及如何防止网络活动唤醒计算机 。 因此,在这里的示例中,我们将防止键盘唤醒PC。 你为什么想做这个? 一句话:猫。

(This should, however, work for other devices that may be waking your computer—not just keyboards.)

(但是,这应该适用于可能唤醒计算机的其他设备,而不仅仅是键盘。)

Open Device manager by pressing the Windows key, typing “Device Manager,” and then pressing Enter.

通过按Windows键,键入“设备管理器”,然后按Enter打开设备管理器。

wpw_8

In the Device Manager window, locate the device you want to prevent from waking your computer. It will have the same name as it does in the output of the powercfg command you just ran. Right-click the device and select “Properties” from the context menu.

在“设备管理器”窗口中,找到要防止唤醒计算机的设备。 它的名称与您刚运行的powercfg命令的输出名称相同。 右键单击设备,然后从上下文菜单中选择“属性”。

wpw_a

On the “Power Management” tab of the device’s properties window, disable the “Allow this device to wake the computer” option and then click “OK.”

在设备属性窗口的“电源管理”选项卡上,禁用“允许此设备唤醒计算机”选项,然后单击“确定”。

wpw_b

While you’ve got Device Manager open, go ahead and disallow any other devices you don’t want waking up your computer. When you’re done, you can exit Device Manager.

打开“设备管理器”后,继续进行操作,并禁止任何您不想唤醒计算机的其他设备。 完成后,您可以退出设备管理器。

禁用唤醒计时器和计划任务 (Disable Wake Timers and Scheduled Tasks)

The other thing that can wake your PC is a scheduled task. Some scheduled tasks—for example, an antivirus app that schedules a scan—can set a wake timer to wake your PC at specific time to run an app or command. To see a list of wake timers set on your computer, you can use a Command Prompt command. You’ll have to run Command Prompt with administrative privileges for this one. To do so, hit Start, type “command,” and when you see the Command Prompt app, right-click it and choose “Run as administrator.”

可以唤醒您的PC的另一件事是计划任务。 某些计划的任务(例如,防病毒应用程序可以安排扫描时间)可以设置唤醒计时器,以在特定时间唤醒PC来运行应用程序或命令。 要查看计算机上设置的唤醒计时器列表,可以使用命令提示符命令。 您必须使用此命令的管理特权运行命令提示符。 为此,请单击开始,键入“命令”,然后在看到命令提示符应用程序时,右键单击它,然后选择“以管理员身份运行”。

wpw_11

In the Command Prompt window, type the following command and then press Enter:

在“命令提示符”窗口中,键入以下命令,然后按Enter:

powercfg -waketimers
wpw_12

In this example, you can see I have one wake timer—a scheduled task set to check whether I have any large files queued for downloading so that I can have the downloading happen when I’m not using the PC.

在此示例中,您可以看到我有一个唤醒计时器,这是一个计划任务,用于检查是否有大文件排队等待下载,以便在不使用PC时可以进行下载。

You have to choices for stopping this: you can disable that specific wake timer, or disable all wake timers.

您必须选择停止它:您可以禁用该特定的唤醒计时器 ,或禁用所有唤醒计时器

If you just want to stop one task from waking your computer, you can uninstall the app that created the task or adjust the scheduled task settings. You can read the full instructions for working with scheduled tasks in our article on automatically running programs with the Windows Task Scheduler, but here’s the short version.

如果您只想停止唤醒计算机的一项任务,则可以卸载创建任务的应用程序或调整计划的任务设置。 您可以阅读有关使用Windows Task Scheduler自动运行程序的文章中的有关计划任务的完整说明,但这是简短版本。

Find the task in Task Scheduler, right-click it, and then choose “Properties”. In the Properties window, on the “Conditions” tab, turn off the “Wake the computer to run this task” option.

在任务计划程序中找到任务,右键单击它,然后选择“属性”。 在“属性”窗口中的“条件”选项卡上,关闭“唤醒计算机以运行此任务”选项。

wpw_13

This leaves the scheduled task in place and, if your PC is awake, Windows will run the task. It just won’t wake the PC in order to do it.

这样可以将计划的任务保留在原位,并且如果您的PC处于唤醒状态,Windows将运行该任务。 它只是不会唤醒PC来执行此操作。

If you don’t want any programs waking your computer up automatically, you can disable wake timers entirely. To do so open the Power Options Control Panel app it by hitting Start, typing “power options,” and then pressing Enter.

如果您不希望任何程序自动唤醒计算机,则可以完全禁用唤醒计时器。 为此,通过单击开始,键入“电源选项”,然后按Enter,打开Power Options Control Panel应用程序。

wpw_14

In the Power Options window, click the “Change plan settings” link next to the plan you use.

在“电源选项”窗口中,单击所使用计划旁边的“更改计划设置”链接。

wpw_15

In the next window, click the “Change advanced power settings” link.

在下一个窗口中,单击“更改高级电源设置”链接。

wpw_16

Expand the “Sleep” entry, expand the “Allow wake timers” entry below it, and then set the entries below it to “Disabled.” If you’re on a laptop, you’ll see two entries—“On battery” and “Plugged in”—and you can configure these for different settings if you want. If you’re using a desktop PC, you’ll only see one setting under the “Allow wake timers” entry, as in this example.

展开“睡眠”条目,展开其下方的“允许唤醒计时器”条目,然后将其下方的条目设置为“禁用”。 如果您使用的是笔记本电脑,则会看到两个条目-“电池供电”和“插入电源”,并且可以根据需要为不同的设置进行配置。 如果您使用的是台式机,则在“允许唤醒计时器”条目下只能看到一个设置,如本例所示。

wpw_17

Note that if you’re using Windows 10, you’ll also have a third option other than just enabling or disabling the wake timer. This option is called “Important Wake Timers Only” and wakes your PC only for major Windows system events like a scheduled restart of your PC outside active hours following a Windows update. You can try setting your wake timers to “Important Wake Timers Only” and see if it solves your problems. If your PC is still waking up more often than you’d like, you can always come back and set wake timers to “Disabled” instead.

请注意,如果您使用的是Windows 10,则除了启用或禁用唤醒计时器外,还有第三种选择。 此选项称为“仅重要的唤醒计时器”,仅在Windows更新之后的活动时间以外按计划重新启动PC时,才用于主要Windows系统事件唤醒PC。 您可以尝试将唤醒计时器设置为“仅重要的唤醒计时器”,看看它是否可以解决您的问题。 如果您的PC仍然比所需的唤醒时间更多,则可以随时返回并将唤醒计时器设置为“ Disabled”。

防止自动维护唤醒您的PC (Prevent Automatic Maintenance From Waking Your PC)

By default, Windows runs automatic maintenance tasks at 2:00 am every night if you’re not using your computer. It’s also set to wake your PC from sleep to run those tasks. These tasks include things like checking to see if your hard drive needs defragmenting, running system diagnostics, checking for disk volume errors, and more. They are important tasks to have run periodically, but if  you’d prefer that Windows not wake your PC to do it, you can turn that setting off. We’re using Windows 10 as our example here, but you’ll find the settings in the same place in Windows 8 and 7.

默认情况下,如果您不使用计算机,则Windows每天晚上2:00运行自动维护任务。 还可以将PC从睡眠状态唤醒以运行这些任务。 这些任务包括诸如检查硬盘驱动器是否需要进行碎片整理,运行系统诊断程序,检查磁盘卷错误等内容。 它们是定期运行的重要任务,但是如果您希望Windows不要唤醒PC来执行此操作,则可以关闭该设置。 我们在这里以Windows 10为例,但是您会在Windows 8和7的同一位置找到这些设置。

In Control Panel, switch to icon view and then open the Security and Maintenance app.

在控制面板中,切换到图标视图,然后打开“安全和维护”应用程序。

wpw_w

On the Security and Maintenance page, expand the “Maintenance” section and then click “Change maintenance settings.”

在“安全和维护”页面上,展开“维护”部分,然后单击“更改维护设置”。

wpw_x

On the Automatic Maintenance page, turn off the “Allow scheduled maintenance to wake up my computer at the scheduled time” option. Of course, you can also set the schedule time to something you like better if you want.

在“自动维护”页面上,关闭“允许计划的维护以在计划的时间唤醒计算机”选项。 当然,您也可以根据需要将时间表时间设置为更好的时间。

wpw_y

If you do turn off Windows’ ability to wake your PC to run maintenance tasks, you should still let it run those maintenance tasks occasionally. You can do that by setting the scheduled time to when you’re more likely to have your PC turned on or you can do it manually by clicking “Start maintenance” back on the main Security and Maintenance page.

如果确实关闭Windows唤醒计算机以运行维护任务的功能,则仍应让它偶尔运行这些维护任务。 您可以通过将计划时间设置为更有可能打开计算机的时间来做到这一点,也可以通过单击“安全和维护”主页面上的“开始维护”来手动进行设置。

wpw_z


Sleep is a valuable tool for preserving energy while still keeping your PC immediately available when you need it. While you’ll likely want some devices (like your keyboard) and some scheduled tasks to be able to wake up your PC, it’s good to know that you have some tools for investigating why it’s waking up and options for stopping it from happening when you don’t want it to.

睡眠是节省能源的宝贵工具,同时在需要时仍可让您的PC保持立即可用。 虽然您可能希望某些设备(例如键盘)和某些计划的任务能够唤醒PC,但很高兴知道您有一些调查原因,以及可以选择阻止唤醒的工具。不想。

翻译自: https://www.howtogeek.com/122954/how-to-prevent-your-computer-from-waking-up-accidentally/

vb唤醒计算机

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值