Jump to content
nghtmare

[MS-DOS] CPU Monitor

Recommended Posts

Just a fun little program I wrote up that acts as a CPU monitor. It's written in MS-DOS/Batch, whatever you want to call it, so it'll work on any Windows OS.

The code is as follows;

@echo off
setlocal EnableDelayedExpansion
title CPU Monitor
mode 48,29
set "space= "
:reset
set count=0
for /l %%A in (25,-1,1) do (
    set "hold=|"
    set /a yaxis=%%A*4
    if !yaxis! LSS 10 set "yaxis=%space%%space%!yaxis!"
    if !yaxis! GTR 10 if !yaxis! LSS 100 set "yaxis=%space%!yaxis!"
    for /l %%B in (1,1,40) do set "hold=!hold!%space%"
    set Line[%%A]=!yaxis!%%.!hold!^|
)
:replace
set /a count+=1
:recheck
for /f "tokens=1,2 delims=^=" %%A in ('wmic cpu get loadpercentage /value') do if not "%%B"=="" set Usage=%%B
Set Usage=%Usage: =%
if "!Usage!"=="" goto :recheck
set /a check=!Usage! %% 4
if !check! GTR 0 (set /a lineNumb=!Usage!/4+1) else if !Usage!==0 (set lineNumb=1) else set /a lineNumb=!Usage!/4
set /a countUpTo=%count%+5
set /a ncount=%count%+6
set Line[%lineNumb%]=!Line[%lineNumb%]:~0,%countUpTo%!*!Line[%lineNumb%]:~%ncount%!
cls
echo.     ----------------CPU Usage-----------------
for /l %%A in (25,-1,1) do echo.!Line[%%A]!
echo.                     Seconds
echo. CPU Usage : %Usage%%%
if !count!==39 goto :reset
goto :replace

To use this program, you just need to create a blank .bat file and paste the above code into it.

Screenshot;

Spoiler

bb3c2e51a6ff0eb0a03ac972d649ff6e.png

 

Edited by nghtmare

Share this post


Link to post
Share on other sites
1 hour ago, Clair said:

Other users be careful when doing stuff like this.

Batch is a language that can seriously fuck up your computer if you don't know what you're doing and just add run random scripts, however I like to think I'm legitimate. None of my scripts ever contain any harmful code.

Share this post


Link to post
Share on other sites
On Tuesday, January 24, 2017 at 10:48 PM, nghtmare said:

Batch is a language that can seriously fuck up your computer if you don't know what you're doing and just add run random scripts, however I like to think I'm legitimate. None of my scripts ever contain any harmful code.

 

On Tuesday, January 24, 2017 at 8:54 PM, Clair said:

Other users be careful when doing stuff like this.

Literally irrelevant. You don't just type random shit in and your computer blows up. You have to know a bit to even know what to play around with. 

Share this post


Link to post
Share on other sites
23 minutes ago, forrest said:

 

Literally irrelevant. You don't just type random shit in and your computer blows up. You have to know a bit to even know what to play around with. 

It's not the fact that your computer "blows up" lmao. Do you know anything about Batch?
It can completely wipe your computer, it can infinite loop and crash your computer.
Nothing just "blows up" your computer unless your fan stops working. I completely understand where @Clair is coming from, you should not just run random scripts/programs.

Share this post


Link to post
Share on other sites
10 minutes ago, nghtmare said:

It's not the fact that your computer "blows up" lmao. Do you know anything about Batch?
It can completely wipe your computer, it can infinite loop and crash your computer.
Nothing just "blows up" your computer unless your fan stops working. I completely understand where @Clair is coming from, you should not just run random scripts/programs.

I've very familiar. You make it sound like a random 12 year old can type clear and it wipes their computer.  There is a bit of research involved

Share this post


Link to post
Share on other sites
1 minute ago, forrest said:

I've very familiar. You make it sound like a random 12 year old can type clear and it wipes their computer.  There is a bit of research involved

There is no research when you copy and paste and run random scripts.

 

EDIT: My point being, anybody can write up a script and have a random 12 year old run it and it may or may not be harmful. So yes, it really is that simple.

Edited by nghtmare

Share this post


Link to post
Share on other sites

Batch takes me back a while...lol. Here's one I wrote about 5 years ago when me and my wife moved in together and wanted to listen to harry potter audio books at night without having to worry about staying awake to hibernate my laptop.

 

@echo off
:start
color 0a
echo Enjoy Harry Potter 
pause
:clean
color 4e
echo                                _ _  _
echo             *                ^|^;^| ^|^;^| ^|^;^|                         *
echo       +         _  _ _  _    \\.    .  /    _  _ _  _      +
echo   *            ^|^;^|_^|^;^|_^|^;^|    \\: +   /    ^|^;^|_^|^;^|_^|^;^|
echo                \\..      /    ^|^|:+++. ^|    \\.    .  /          *
echo        +        \\.  ^,  /     ^|^|:+++  ^|     \\:  .  /
echo                  ^|^|:+  ^|_   _ ^|^|_ . _ ^| _   _^|^|:+  ^|      *
echo            *     ^|^|+++.^|^|^|_^|^;^|_^|^;^|_^|^;^|_^|^;^|_^|^;^|^|+++ ^|         +
echo                  ^|^|+++ ^|^|.    .     .      . ^|^|+++.^|  *
echo  +   *           ^|^|: . ^|^|:.     . .   .  ^,   ^|^|:   ^|              *
echo           *      ^|^|:   ^|^|:  ^,     +       .  ^|^|: ^, ^|     +
echo    *             ^|^|:   ^|^|:.     +++++      . ^|^|:   ^|        *
echo       +          ^|^|:   ^|^|.     +++++++  .    ^|^|: . ^|   +
echo                  ^|^|: . ^|^|: ^,   +++++++ .  .  ^|^|:   ^|       *
echo           _    _ ^|^|: . ^|^|: ^,   +++++++ .  .  ^|^|:   ^| _
echo          ^| ^|__^| ^|  ___   __ _  _      _  __ _  _ __ ^| ^|_   ___
echo          ^|  __  ^| / _ \ / _^` ^|^| \ /\/  /  _^  ^|^| __ ^|^| _^| / ___^|
echo          ^| ^|  ^| ^|^| ^(_^) ^| ^(_^| ^| \ V  V /^| ^(_^| ^|^| ^|   ^| ^|_ \___ \
echo          ^|_^|  ^|_^| \___/ \__^, ^|  \_/\_/  \__^,_^|^|_^|    \__^|^|____/
echo                          __/ ^|                     
echo                         ^|___/
color 4e
echo Now type the number of hours you'd like
set /p Hour=to set on the timer without spaces (1 to 5)
if '%Hour%'=='1' timeout -t 3600 /nobreak && shutdown -h
if '%Hour%'=='2' timeout -t 7200 /nobreak && shutdown -h
if '%Hour%'=='3' timeout -t 10800 /nobreak && shutdown -h
if '%Hour%'=='4' timeout -t 14400 /nobreak && shutdown -h
if '%Hour%'=='5' timeout -t 18000 /nobreak && shutdown -h
if '%Hour%'=='73' cls & color 0d &echo This is an easter egg & echo Hidden message here & echo Hidden message here & echo Hidden message here& echo Hidden message here& echo Hidden message here& echo Hidden message here & echo Hidden message here                       .-~-. & echo Hidden message here                     .'     '. & echo Hidden message here                    /         \ & echo Hidden message here            .-~-.  :           ; & echo Hidden message here          .'     '.^|           ^| & echo Hidden message here         /         \           : & echo Hidden message here        :           ; .-~""~-,/ & echo Hidden message here        ^|           /`        `'. & echo Hidden message here        :          ^|             \ & echo Hidden message here         \         ^|             / & echo Hidden message here          `.     .' \          .' & echo Hidden message here            `~~~`    '-.____.-' & echo Hidden message here & echo Hidden message here & echo Hidden message here& echo Hidden message here& echo Hidden message here& pause & cls & goto start
if not '%Hour%'=='1' ECHO "%Hour%" is not valid please try again & pause & cls &echo Enjoy Harry Potter & goto clean
if not '%Hour%'=='2' ECHO "%Hour%" is not valid please try again & pause & cls &echo Enjoy Harry Potter & goto clean
if not '%Hour%'=='3' ECHO "%Hour%" is not valid please try again & pause & cls &echo Enjoy Harry Potter & goto clean
if not '%Hour%'=='4' ECHO "%Hour%" is not valid please try again & pause & cls &echo Enjoy Harry Potter & goto clean
if not '%Hour%'=='5' ECHO "%Hour%" is not valid please try again & pause & cls &echo Enjoy Harry Potter & goto clean
if not '%Hour%'=='73' ECHO "%Hour%" is not valid please try again & pause & cls &echo Enjoy Harry Potter & goto clean

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×