windows - 如何在 Batch 中获取电池百分比?

标签 windows batch-file cmd batterylevel

所以,我只想知道如何在Batch中获取电池百分比。
我觉得如果格式是这样就好了:

:forever
get-battery
if "%battery%"=="100%" goto reached100
goto forever

:reached100  
echo Your battery has finished charging!
goto forever

最佳答案

scientist_7 的答案应该被标记为正确。

当然,没有法律禁止从批处理中调用 powershell。

powershell -command "(Get-WmiObject Win32_Battery).EstimatedChargeRemaining"
56

关于windows - 如何在 Batch 中获取电池百分比?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26792191/

相关文章:

python - 获取外部 ip 列表并在 Python 中转换为变量 dic

json - Powershell - 从字符串中删除

java - 作为 Windows 服务运行时的 Tomcat 日志记录

shell - 从命令行启动 Lisp 程序时如何指定包名?

windows - 如何使用没有管理员权限的 vbs 将任务设置为在登录时以当前用户身份运行?

windows - 获取帮助和/?之间的区别在 powershell 中

windows - 批处理文件中的 Unicode 字符

c++ - 使用 C++ 从 bios 获取 Assets 标签和序列号

batch-file - 以秒为单位批量重命名文件到创建时间

windows - 了解 cmd shell 中的变量