Hack Forums
[Shell] Battery Report & Energy Statistics - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [Shell] Battery Report & Energy Statistics (/showthread.php?tid=5534957)



Battery Report & Energy Statistics - motherfawker666 - Jan 26, 2017

This script was made so that you could easily generate a battery report / energy report and have it automatically delete itself afterwards. This script can be run from a USB drive as well. If you are having battery problems on any laptops / tablets running Windows these reports will help you get an easy grasp on what is going on. I hope this helps someone :)

Code
::This file detects which version of windows you are running
::and dynamically chooses the appropriate way to view battery
::and energy related information.
::
::It then automatically deletes any files it generated and exits.
::
::Scripted by mf666
::Contact me @ [email protected]

@echo off
%systemdrive%
cd %temp%
set TTL=title Battery Report Generator -
set EXMS=echo Exiting...
%TTL% Checking Windows Version

echo Checking Windows version...
setlocal
for /f "tokens=4-5 delims=. " %%i in ('ver') do set VERSION=%%i.%%j
set VRMS=echo Windows version %version% detected!
if "%version%" == "10.0" %TTL% Windows 10 & %VRMS% & goto :8PLUS
if "%version%" == "6.3" %TTL% Windows 8.1 & %VRMS% & goto :8PLUS
if "%version%" == "6.2" %TTL% Windows 8 & %VRMS% & goto :8PLUS
if "%version%" == "6.1" %TTL% Windows 7 & %VRMS% & goto :SEVEN
endlocal

goto :ERROR1

:ERROR
%TTL% He's dead Jim...
echo. & echo ====SOMETHING SEEMS TO HAVE GONE WRONG!====
echo Try running this script as an administrator!
pause
%EXMS%
ping localhost > nul
exit

:ERROR1
%TTL% Incompadible Windows version...
echo. & echo This script only supports Windows version 6.1 (7) - 10.0...
echo Your version is:
ver
pause
%EXMS%
ping localhost > nul
exit

:8PLUS
echo Generating battery report...
powercfg /batteryreport
if exist "Battery-Report.html" start /wait Battery-Report.html else goto :ERROR
echo Waiting...
ping localhost > nul
echo Deleting temp files...
del /f /q Battery-Report.html
%EXMS%
exit

:SEVEN
echo Building energy report...
powercfg /energy
if exist "energy-report.html" start /wait energy-report.html else goto :ERROR
echo Waiting...
ping localhost > nul
echo Deleting temp files...
del /f /q energy-report.html
%EXMS%
exit



* - motherfawker666 - Jan 28, 2017

People here really have a problem with scripts that are practical.


* - gogglebot - Jan 28, 2017

This is so good, the presentation is amazing, and now I know how screwed my battery actually is! :D
Hope you stick around here!


* - JoshuTee - Jan 29, 2017

(Jan 28, 2017 09:07 PM)motherfawker666 Wrote:  People here really have a problem with scripts that are practical.

So damn true. I'm sorry you didn't get any recognition on this.


* - Hackoo - Jan 29, 2017

Hi motherfawker666 ✌
Very nice script ! i like it and i will use it with your permission if you don't mind ! 🤗
I tested on my windows 7 (32 bits) and it worked like a charm
Very useful script ! 👍
Thank you for this nice share ! and don't stop to share other useful scripts like that 😉
cheers
👍


* - motherfawker666 - Jan 31, 2017

You are all free to use this tool as you see fit. I require/desire no attribution.