This article prevents some ideas of how to clean up your computer which has the Windows Operating System. The clean up here does to refer to any kind of virus or spyware removal. Instead, this article focuses on how to get rid of the junk that we or Windows itself accumulates on your computer throughout the years.
1. Scan using antivirus.
Although this article is not about removing virus but on the cleaning of junk files, one of the first step is to simply do a virus scan - just in case. Some useful articles are:
- using online virus scanners: http://xtechnotes.blogspot.com/2008/07/antivirus-online-scan.html
- discounted antivirus software http://xtechnotes.blogspot.com/2012/01/security-software-discounts-and-special.html
- news on security http://xtechnotes.blogspot.com/2011/08/news-security.html
- how to secure your computer: http://xtechnotes.blogspot.com/2010/03/how-to-secure-your-computer.html
2. Remove all unwanted programs.
Find a list of all your installed programs by going to Control Panel - Add or Remove Programs.
Decide which programs you do not need and uninstall them.
- some uninstaller software: http://xtechnotes.blogspot.com/2011/07/links-to-free-software.html
3. Find what is running in the background
Windows services are programs that run in the background after starting up themselves when the computer is switched on. Many will not tell you they are running. To find a list of these "services", go to Control Panel - Administrative Tools - Services.
Find those services which you know is definitely not needed, whether they are from Windows or not. There is no clear way to identify which service you don't want - they will come from experience. Basically just look at the name of the services - a weird name does not mean it is not needed. Sometimes look for a service with a simple name which you definitely know is not required. Example: If your computer has no wireless connection, then look for service with the name wireless and Disable it.
4. Clean the Registry
WARNING: If anything goes wrong at this step, very often this will make your whole computer unable to start and you may lose everything.
This step should be done by experienced users only.
Some tools to check are: CCleaner and TweakNow RegCleaner. (see http://xtechnotes.blogspot.com/2011/07/links-to-free-software.html )
5. Are all your files compressed?
Some computers may have come out of the box, configured to compress all your files by default. In Windows Explorer, if your files has filenames appearing in colour, then it may be compressed. To switch off this option, in Windows Explorer, right click on the folder and select Properties. Then uncheck any box for compression, for that file, folder or the entire drive.
6. Check updates
Ensure all updates including Windows Update and other antivirus updates are up to date.
7. Avoid re-installing Windows
Only reinstall Windows as a very last resort.
8. Cleaning Temporary Files
Ref: http://forum.wegotserved.com/index.php/tutorials/article/72-keeping-your-system-partition-cleaned-up-on-a-schedule/
C:\WINDOWS\system32\config\systemprofile\Local Settings\Temp\*.*
c:\temp\*.*
c:\windows\kb*.log
c:\windows\temp\*.*
- delete windows update uninstall files
dir c:\windows\$nt*
- delete Internet Explorer update uninstall files
dir c:\windows\ie8updates
..... any more ideas are appreciated ....
Showing posts with label Windows Registry. Show all posts
Showing posts with label Windows Registry. Show all posts
Thursday, January 19, 2012
Thursday, May 14, 2009
techNote_Append Registry Via Visual Studio Setup Project
How can I append a directory to the PATH environment variable when creating a Visual Studio Setup project.
Objective: To be able to APPEND Path Environment Variable by changing Windows Registry setting, using a MSI Windows Installer created by a Visual Studio Setup project.
End Product: An exe and a msi file to install a program and also change registry setting automatically. When the program is uninstalled (via Add or Remove programs) then the registry setting will be changed to the pre-installation state.
Reference: This article is based on the article and code found below, but with necessary modifications.
http://askville.amazon.com/append-directory-PATH-environment-variable-Visual-Studio-Deployment-installation-Project/AnswerViewer.do?requestId=4628663
The code presented in askville, assumes that the path to be added is only the path where the programs are installed. For example if pre-install path = "c:\temp", and the program is to be installed in "c:\programs", then the final path would be "c:\temp;c:\programs".
With the modifications I made to the code, it allows the user to setup multiple additional paths, not only where the program is installed. The scenario is like this:
Preinstall path variable: c:\temp
Additional paths: c:\dirA;c:\dirB
Installation path: c:\programs
Intended final path: c:\temp;c:\dirA;c:\dirB;c:\programs
After uninstall path: c:\temp
Basically, the idea is to create a custom action class and then configure the Setup project.
Here are the detailed steps of how to construct the Visual Studio setup project.
1. Copy the code below and put into an empty C# class and called in Installer1.cs. Need to change the Namespace in the code to tailor to the namespace of your project.
Basically, the C# code override the Install, Uninstall, and Rollback methods of the standard Installer class.
2. The C# class file in step 1 need to be put into a C# project. It could be a new project or it could one of your working project to be included in the Setup Project.
3. Create the Visual Studio Setup Project. Add the C# project in step 2 to the setup. This is done in the normal way by right clicking the setup project in Solution Explorer. Click Add -> Project Output. Then select that C# project and select Primary Output, then click OK.
4. Right click on your Setup project, select View|Custom Actions, and then right-click on Install, Rollback, and Uninstall to add the assembly containing the custom action class to each one.
5. Finally add any additional directories to the user path via the Registry by the following:
i) Assume that the new variable to be appended to the User Path is called "MySetup". This name "MySetup"
is hard coded to the function GetAddedPath, which can be changed as desired.
ii) Right click on the setup project, choose View -> Registry.
iii) In the Registry editor, go to HKEY_CURRENT_USER and add new Key "Environment" if it is not there already.
iv) Click on the new "Environment" entry and ADD -> New -> Environment String Value.
v) on the right hand pane, name the new variable as "MySetup".
vi) Click on the entry "MySetup" and in its property box, write the value of any subdirectories you wish to
include in the user path.
---------------------------
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;
using Microsoft.Win32;
namespace YOUR_OWN_NAMESPACE
{
/// <summary>
/// A Custom Action class that provides action to append registry for MS Setup project.
/// </summary>
[RunInstaller(true)]
public partial class Installer1 : Installer
{
public Installer1()
{
InitializeComponent();
}
public override void Install(System.Collections.IDictionary stateSaver)
{
base.Install(stateSaver);
string curPath = GetUserPath();
stateSaver.Add("previousPath", curPath);
string newPath;
if (curPath.Length == 0 ) {
newPath = AddPath(GetAddedPath() , MyPath());
}else{
newPath = AddPath(curPath, GetAddedPath()+";"+MyPath());
}
if (curPath != newPath)
{
stateSaver.Add("changedPath", true);
SetPath(newPath);
}
else
stateSaver.Add("changedPath", false);
}
public override void Uninstall(System.Collections.IDictionary savedState)
{
base.Uninstall(savedState);
if ((bool)savedState["changedPath"])
{
SetPath(RemovePath(GetUserPath(), MyPath()));
SetPath(RemovePath(GetUserPath(), GetAddedPath()));
}
}
public override void Rollback(System.Collections.IDictionary savedState)
{
base.Rollback(savedState);
if ((bool)savedState["changedPath"])
SetPath((string)savedState["previousPath"]);
}
internal static string MyPath()
{
string myFile = System.Reflection.Assembly.GetExecutingAssembly().Location;
string myPath = System.IO.Path.GetDirectoryName(myFile);
return myPath;
}
private static RegistryKey GetPathRegKey(bool writable)
{
// for the user-specific path...
return Registry.CurrentUser.OpenSubKey("Environment", writable);
// for the system-wide path...
//return Registry.LocalMachine.OpenSubKey(
// @"SYSTEM\CurrentControlSet\Control\Session Manager\Environment", writable);
}
private static void SetPath(string value)
{
using (RegistryKey reg = GetPathRegKey(true))
{
reg.SetValue("Path", value, RegistryValueKind.ExpandString);
}
}
internal static string GetUserPath()
{
using (RegistryKey reg = GetPathRegKey(false))
{
return (string)reg.GetValue("Path", "", RegistryValueOptions.DoNotExpandEnvironmentNames);
}
}
internal static string GetAddedPath()
{
using (RegistryKey reg = GetPathRegKey(false))
{
return (string)reg.GetValue("MySetup", "", RegistryValueOptions.DoNotExpandEnvironmentNames);
}
}
private static string AddPath(string list, string item)
{
List<string> paths = new List<string>(list.Split(';'));
foreach (string path in paths)
if (string.Compare(path, item, true) == 0)
{
// already present
return list;
}
paths.Add(item);
return string.Join(";", paths.ToArray());
}
private static string RemovePath(string list, string item)
{
List<string> paths = new List<string>(list.Split(';'));
for (int i = 0; i < paths.Count; i++)
if (string.Compare(paths[i], item, true) == 0)
{
paths.RemoveAt(i);
return string.Join(";", paths.ToArray());
}
// not present
return list;
}
}
}
Subscribe to:
Posts (Atom)