锂电池怎样监视电量_我可以使用任务计划程序监视计算机的电池吗?

锂电池怎样监视电量_我可以使用任务计划程序监视计算机的电池吗?

锂电池怎样监视电量

锂电池怎样监视电量_我可以使用任务计划程序监视计算机的电池吗?

If you like to keep a close eye on your laptop’s battery charge level, then you may be looking for a built-in way to help monitor it while you are busy working. Is there one or do you need a custom solution? Today’s SuperUser Q&A post has the answer to a battery monitoring reader’s question.

如果您想密切关注笔记本电脑的电池电量,那么您可能正在寻找一种内置的方式来在忙于工作时对其进行监视。 是否有一个,或者您需要定制解决方案? 今天的《超级用户问答》帖子为电池监控读者的问题提供了答案。

Today’s Question & Answer session comes to us courtesy of SuperUser—a subdivision of Stack Exchange, a community-driven grouping of Q&A web sites.

今天的“问答”环节由SuperUser提供,它是Stack Exchange的一个分支,该社区是由社区驱动的Q&A网站分组。

问题 (The Question)

SuperUser reader MiHa wants to know how to create a task in Task Scheduler for battery level changes on his laptop:

超级用户阅读器MiHa想知道如何在Task Scheduler中创建任务以在笔记本电脑上更改电池电量:

I need to create a task in Task Scheduler based on battery level changes. For example, say my laptop’s battery drops from 67 percent to 66 percent charge remaining. How can I run a task based on this event? Does Windows log this at all? I was unable to find information on this anywhere.

我需要根据电池电量变化在任务计划程序中创建任务。 例如,假设我的笔记本电脑的电池剩余电量从67%下降到66%。 如何基于此事件运行任务? Windows是否完全记录了此信息? 我无法在任何地方找到有关此信息。

How do you create a task in Task Scheduler for battery level changes?

如何在Task Scheduler中创建任务以更改电池电量?

答案 (The Answer)

SuperUser contributor DavidPostill has the answer for us:

超级用户贡献者DavidPostill为我们提供了答案:

I Need to Create a Task in Task Scheduler Based on Battery Level Changes

我需要根据电池电量变化在任务计划程序中创建任务

Windows does not log this kind of information/details as events. You can, however, use something like the batch file below and create a custom event.

Windows不会将此类信息/详细信息记录为事件。 但是,您可以使用下面的批处理文件之类的东西并创建一个自定义事件。

Battery.cmd

电池.cmd

This batch file monitors the current battery percentage charge and creates a user defined event if the charge drops below a user defined threshold value.

该批处理文件监视当前电池百分比电量,如果电量下降到用户定义的阈值以下,则创建用户定义的事件。

锂电池怎样监视电量_我可以使用任务计划程序监视计算机的电池吗?

Notes:

笔记:

  • The eventcreate command works on Windows XP up to and including Windows 10. It requires administrator privileges to work.

    eventcreate命令在Windows XP以及更高版本的Windows 10上均可使用。它需要管理员权限才能工作。
  • Set _threshold as required.

    根据需要设置_threshold。
  • If the battery falls below this value, an event with ID 999 will be generated in the APPLICATION event log with the description “Battery charge has dropped”.

    如果电池低于该值,则将在APPLICATION事件日志中生成ID为999的事件,其描述为“电池电量已下降”。
  • Modify the eventcreate command as required for your situation.

    根据您的情况修改eventcreate命令。
  • Modify the timeout delay as required for your situation.

    根据您的情况修改超时延迟。

Example Output

示例输出

My battery currently has a charge of 81 percent. I set the threshold to 82 percent. Here is what happens when I run Battery.cmd:

我的电池当前电量为81%。 我将阈值设置为82%。 当我运行Battery.cmd时,会发生以下情况:

锂电池怎样监视电量_我可以使用任务计划程序监视计算机的电池吗?

And here is the new entry in the Event Log:

这是事件日志中的新条目:

锂电池怎样监视电量_我可以使用任务计划程序监视计算机的电池吗?

EventCreate Syntax

EventCreate语法

锂电池怎样监视电量_我可以使用任务计划程序监视计算机的电池吗?

Further Reading

进一步阅读

  • An A-Z Index of the Windows CMD Command Line – An excellent reference for all things Windows command line related.

    Windows CMD命令行的AZ索引 – Windows命令行相关所有内容的出色参考。

  • eventcreate – Create a custom event in the Windows Event Viewer.

    eventcreate –在Windows事件查看器中创建自定义事件。

  • schtasks – Create or edit a scheduled job/task. The job can be created on a local or remote computer.

    schtasks –创建或编辑计划的作业/任务。 可以在本地或远程计算机上创建作业。

  • wmic – Windows Management Instrumentation Command.

    wmic – Windows管理规范命令。



Have something to add to the explanation? Sound off in the comments. Want to read more answers from other tech-savvy Stack Exchange users? Check out the full discussion thread here.

有什么补充说明吗? 在评论中听起来不错。 是否想从其他精通Stack Exchange的用户那里获得更多答案? 在此处查看完整的讨论线程

Image Credit: DavidPostill (SuperUser)

图片来源: DavidPostill(超级用户)

翻译自: https://www.howtogeek.com/289579/can-i-use-task-scheduler-to-monitor-my-computers-battery/

锂电池怎样监视电量