DIY简易CPU,内存脚本

 

Name         CPU(p) ----         ------

_Total          100

Idle            100

Skype            12

dwm               6

SnagitEditor      6

 

Name                 CPU(s) ----                 ------

Skype           7000.578125

Thunder          3189.84375

ThunderPlatform     1346.25

firefox          951.921875

explorer          646.46875

 

FreePhysicalMemory ------------------            

859072

 

~~~~~~~~~~~

No matter how much money you have invested in a new computer, sooner or later you will face performance problems.

These problems are usually related with the CPU or the memory. Computers are becoming so complex that you need all the help you can get to find the source of the problems.

The first thing I do when I notice that my computer is not acting as it should is run Task Manager. With this tool you can easily see the usage of Memory and CPU of every process on your computer. I always do the same: look for the processes that are using more CPU and see if there are enough physical memory available.

So, why not have a utility that do the same with just one click and that can be easily found in your Windows 7 Taskbar?

To do this we are going to use one component of Windows 7, PowerShell, that can be also used in other Windows versions.

 

PowerShell is an enhancement of VBScript, which is no more than a scripting language.

Even if you don’t understand what a scripting language is, you can just read this post and you will have your utility running for free in no time.

The information this utility is going to display is the following:

Check Memory CPU Monitor CPU and Memory Usage with Just One Click in Windows 7 [How To]

The first list is of every process that is using more than 0 percent of your CPU. This list is sorted by the CPU usage at the moment it’s run. In this case the _Total and the Idle process are not real processes; however, WmiPrvSE is a real process which is using 3% CPU.

The second list displays the 5 running processes that have used more CPU Time. This is measured in seconds. If the computer is running slowly since startup, this is the list you need to check.

The last list is the free physical memory. This cannot be seen as a definitive measure to know the reason for a poor performance but it can be a sign.

Create the Script

So, first we are going to create a folder that is going to have the script that displays the information. I have used c:\utils.

You are going to create a new file in that folder, CheckMemoryCpu.bat in c:\utils.

To do this, open notepad, press WinKey + R, type notepad, and press Enter.

windows 7 Notepad Monitor CPU and Memory Usage with Just One Click in Windows 7 [How To]

Copy the following text to that file.

@echo off
Powershell -command "&{Get-WmiObject -Query 'Select * from Win32_PerfFormattedData_PerfProc_Process '| Select Name, @{Name='CPU(p)';Expression={$_.PercentProcessorTime}} |  where {$_.'CPU(p)' -gt 0 } |Sort 'CPU(p)' -descending | Format-Table -AutoSize;}" Powershell -command "&{Get-Process | Select Name, @{Name='CPU(s)';Expression={$_.CPU}} | sort 'CPU(s)' -Descending | Select -First 5| Format-Table -AutoSize;}" Powershell -noexit -command "&{Get-WmiObject -Query 'Select * from Win32_OperatingSystem' | Select FreePhysicalMemory | Format-Table -AutoSize;}"

It’s not the intention of the article to explain every part of this script.

Windows 7 Notepad CheckMemoryCPU Monitor CPU and Memory Usage with Just One Click in Windows 7 [How To]

Save it as c:\utils\CheckMemoryCPU.bat:

Windows 7 CUtilsCheckMemoryCPU Monitor CPU and Memory Usage with Just One Click in Windows 7 [How To]

If you don’t use the hyphens it will create a text file, with the txt extension.

Relax, take a breath. You have done the more complicated part. Now we are going to pin the utility to the Windows 7 Taskbar.

Pin the Script to the Taskbar

We cannot pin the recent created file to the Taskbar directly, therefore we have to use a trick.

To do this we create a new shortcut.

Right click on a folder or over the Desktop and select New > Shortcut.

Windows 7 New Shorcut Monitor CPU and Memory Usage with Just One Click in Windows 7 [How To]

Type cmd /c  c:\utils\CheckMemoryCPU.bat and click Next.

Windows 7 Create Shortcut Cmdcutilscheckmemorycpur Monitor CPU and Memory Usage with Just One Click in Windows 7 [How To]

Windows asks for a name, I have used CheckMemoryCPU but you can use other if you prefer. Click Finish.

To change the icon right click over the shortcut and click Properties.

Click Change Icon.

Windows 7 ShorCut ChangeICon Monitor CPU and Memory Usage with Just One Click in Windows 7 [How To]

Windows has several files full of very detailed icons. One I like is located in c:\windows\system32\imageres.dll.

Once you find the file you can use the icon you prefer.

Windows 7 Icon Chip Monitor CPU and Memory Usage with Just One Click in Windows 7 [How To]

Now that you have your shortcut created you only have to move to the Taskbar.

Windows 7 Pin ShortCut To Taskbar Monitor CPU and Memory Usage with Just One Click in Windows 7 [How To]

And this is it. Just click it for a quick glance and what is slowing down your PC.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值