To Handle Ad Blocker

Enhance Your Computer's Performance with VBScript

I bought my laptop on 1st November 2013. I started feeling that my laptop is getting slower as I was installing heavy programming software like dot net , java , SQL Server etc. It’s inevitable that all computers will experience slower speeds at some point. As software becomes more demanding, the way in which your PC reacts to these changes can have a big impact on its performance.

I tried below major cost-effective alterations to my 
laptop to make it run faster. These major alterations may not seem like they will speed up your computer performance, but combined they can make it possible to keep your PC functional for some time:
  • Uninstall unnecessary bloatware
  • Limit the programs at startup
  • Add more RAM to your PC
  • Check for spyware and viruses
  • Use Disk Cleanup and de-fragmentation
  • Consider a startup SSD
  • Take a look at your web browser
I've used all the above alterations but I feel that they are the temporary solution. For a permanent solution, Today I'm sharing my custom solution that i had prepared myself for my laptop. After deploying this custom solution, I've never faced the performance related issue.

How to create VBScript

Open a Notepad file. Copy and paste below code in the notepad file and save the program with .vbs extension anywhere or with any name (I'll prefer SystemRefresh.vbs). To test, Double click on the file to run the program. As you will double click, it will start running in the back end.

 On Error Resume Next
 Dim vRefreshableMemoryFolderLocation(3)
 Dim objFSO	: Set objFSO = CreateObject("Scripting.FileSystemObject")
 Dim objShell	: Set objShell = CreateObject("WScript.Shell")

 vKeepRefreshing = "TRUE"
 vRefreshableMemoryFolderLocation(0) = "C:\Windows\Prefetch"
 vRefreshableMemoryFolderLocation(1) = "C:\Windows\Temp"
 vRefreshableMemoryFolderLocation(2) = "C:\Windows\Downloaded Program Files"
 vRefreshableMemoryFolderLocation(3) = "%USERPROFILE%\AppData\Local\Temp"
 
 Do While vKeepRefreshing = "TRUE"
 	For I = LBound(vRefreshableMemoryFolderLocation) To UBound(vRefreshableMemoryFolderLocation)
 		vCurrFolderPath = vRefreshableMemoryFolderLocation(I)
 		If InStr(vCurrFolderPath,"%") > 0 Then
 			vCurrFolderPath = objShell.ExpendEnvironmentStrings(vCurrFolderPath)
 		End If
 		For Each objFile In objFSO.GetFolder(vCurrFolderPath).Files
 			objFSO.DeleteFile(vCurrFolderPath & "\" & objFile.Name)
 		Next
 		For Each objFolder In objFSO.GetFolder(vCurrFolderPath).SubFolders
 			objFSO.DeleteFolder(vCurrFolderPath & "\" & objFolder.Name)
 		Next
 	Next
 	WScript.Sleep 15000
 Loop

How to run VBScript

If you will run the program after saving anywhere on the system. It will stop running as you will restart the system. Solution of this problem is that we place this Script file on the Startup folder location so that whenever system restart then it will start running itself. Perform the below steps to do so:
  1. Open Run Command by pressing Win + R
  2. In Run Command Window, type anyone of the below line and press Enter

    %USERPROFILE%\AppData\Roaming\Microsoft\Start Menu\Programs\Startup
    OR
    shell:startup

  3. Copy and Paste the SystemRefresh.vbs in the Startup Folder and close the folder.

It might be possible that anti-virus or any third party tool installed in your system block this script from executing. In this case, you have to mark this file safe or you have to unblock it. I hope this post is helpful. If you have any questions, feel free to comment it below.


Happy Learning.. :-)