Posts tagged: Command line

Jun 11 2009

How to find what’s running under SVCHost.exe

My PC was behaving sluggishly the other day. I tried to be patient, but had to fire up the task manager when I could bear it no longer. That’s when I noticed great gobs of my swap file allocated to “SVCHOST.EXE”:

whats-running-under-svchost_exe_tasklist-ss

The problem is, SVCHOST is a catch all windows service container. Meaning, many windows services run under the same instance of SVCHOST. How was I going to figure out which services might be the culprit?

Enter the tasklist command.

Tasklist displays info about running tasks, including SVCHOST.

Simply running tasklist at the command prompt displays a laundry list of all running processes. This wasn’t going to do it, so I ran it with the “/?” switch to try and find how to narrow the info…

/SVC Displays services hosted in each process.
/FI filter Displays a set of tasks that match a given criteria specified by the filter.

Looks good so far, now I need to know what filter to apply:

Filters:
    Filter Name     Valid Operators           Valid Value(s)
    -----------     ---------------           --------------------------
    IMAGENAME       eq, ne                    Image name

OK, this gives us:

“C:\>tasklist /svc /FI “IMAGENAME EQ SCVHOST.EXE”

But it seems the filter is case sensitive, because when I run that command, I get this:

INFO: No tasks are running which match the specified criteria.

So, switching to lower case gives me what I want:

“C:\>tasklist /svc /FI “IMAGENAME EQ svchost.exe”

Image Name     PID        Services
=========== =====  =======================
svchost.exe     744        DcomLaunch
svchost.exe     844        RpcSs
svchost.exe     888        AeLookupSvc, AppMgmt,
                                    AudioSrv, BITS, Browser,
                                    CryptSvc, dmserver,
                                    EventSystem,lanmanserver,
                                    lanmanworkstation, Netman,
                                    Nla, RasMan, Schedule,
                                    seclogon, SENS,ShellHWDetection,
                                    Themes, winmgmt, wuauserv
svchost.exe     928         Dhcp, Dnscache
svchost.exe     976         LmHosts, W32Time
svchost.exe     1772       Net Driver HPZ12
svchost.exe     1816       Pml Driver HPZ12
svchost.exe     2424       TermService
svchost.exe     3312       TapiSrv
svchost.exe     2688       W3SVC

From there, it’s just a matter of shutting down or restarting each of the services listed under the process id 888 ( I got this from taskmanager).

Blog Traffic Exchange Related Posts Blog Traffic Exchange Related Websites
  • The Unmatched Windows XP Broadband - Cable Tweaks Guide Does your connection crawl? I bet it does buddy, just try these few simple tweaks, lets get you fixed today. The following tweaks and modifications are the ones I personally perform to my Cable connection after fresh installing windows.Note-This Guide works with DSL and Cable Connections!The first thing I......
  • Top 10 - SEO Do's & Don'ts SEO Do's Create a Useful, Content-Rich Website Properly Optimize Your Website Pages Have Relevant Websites Link to Your Website Analyze and Understand Your Website Statistics Revise Optimization Based on Feedback Create a Long-Term Content Strategy or Plan Do Learn Patience, Search Engine Success Takes Time Understand What Will and Will......
  • Maintenance for your Swimming Pool On a humid and hot day in August, there is nothing that feels quite as good as a dip in your pool. If your pool is looking a little bit more like a pond than a place for swimming, then nobody is going to be happy. Here are some tips......
  • SVCHOST.exe - What is it and why are there so many of them? I get asked this a lot.  When you run Task Manager in XP and look at the process list, you see tons of svchost.exe processes running.  You can't kill them (you don't really want to) and there's no obvious reason that there are so many of them. What are they? ......
  • Tennis Scoring A game of tennis starts with the service and ends when a player has scored 4 points, as long as they are also 2 points ahead of their opponent. Games are generally part of a set, which is a series of games played until one player has reached six wins,......
Jun 04 2009

How to Delete Empty Folders - FREE!

While performing a disk cleanup recently, I had cause to locate and delete any empty folders under a root folder. I knew there had to be a batch file command to accomplish this, but I couldn’t for the life of me remember what it was!

Enter Google.

five minutes of some keyword searching with surgical precision and piecing together commands yielded my solution.

DIR /AD/B/S | SORT > FOLDERLIST.BAT

How It Works.

The Dir command is the familiar directory list command that comes standard with all versions of Windows since 95. The magic is in the switches:

/A Displays files with specified attributes.
When applied to the “D” attribute, it returns directories
/B Uses bare format (no heading information or summary).
/S Displays files in specified directory and all subdirectories.

SORT is an often overlooked command for, you guessed it, sorting. Here, the results of the Dir command are piped (”|”) into the SORT command as input. The result of the SORT command is then redirected from the command prompt to a file called FOLDERLIST.BAT.

Kick it up a notch.

Now that you’ve created this list, say you want to automate the deletion of each entry in the list. This is where pumping the output to a “.bat” file comes in. Open the bat file in textpad, or notepad, or your text editor

For example:

Typing:
DIR /AD/B/S | SORT > FOLDERLIST.BAT

in my C:\Program Files\Microsoft Visual Studio 8\VC folder yields the following results:

empty-file-results

Next, open the file in a text editor, word, or open office and replace the beginning of each line with the RD command followed by a space and a single quote. Like so:

empty-file-replace

This should give you the following:

empty-file-first-replace

Notice how each line now begins with “RD “” This is the old DOS Remove Directory command. Don’t worry, it only removes empty directories. But you still need to add an ending quote to each line. This is where Word or Open Office is handy. You can do another search and replace, but this time search for “^p” (new paragraph) and replace with ““^p” (end quote and new paragraph).

Save the file, and you’re all done except the double clicking.

Blog Traffic Exchange Related Posts Blog Traffic Exchange Related Websites
  • Bash Tips & Tricks http://www.ukuug.org/events/linux2003/papers/bash_tips/ http://www.gbdirect.co.uk/ Power Shell Usage Bash Tips & Tricks Simon Myers simon.myers@gbdirect.co.uk UKUUG Linux 2003 Conference • August 2003 http://www.ukuug.org/events/linux2003/ This view lists all the slides from the talk in a continuous format. There is a PDF version available, suitable for printing on A4 paper. The slides are also......
  • Weight Loss Tips and Tricks When it comes to losing weight, you probably know the drill. Burn more calories than you consume, eat healthy, and be healthy and the results will happen. Most diets and weight loss plans do not have much substance which is why dieting in general is far from healthy for you.......
  • Wordpress Backup Wordpress Backup is an essential plugin for all Wordpress blog administrators by the Blog Traffic Exchange. It performs regular backups of your upload (images) current theme, and plugin directories. Backup files are available for download and optionally emailed to a specified email. Don't get caught without a recent backup of......
  • Anti Aging Makeup Tricks and Tips pt 1 There are all kinds of makeup tricks and tips out there, but choosing the right ones for your own personal needs is something that you need to figure out. Here are some unique makeup tricks and tips that are anti-aging in nature. What I meant to say is that there......
  • Anti Aging Makeup Tricks and Tips pt 2 There are makeup tricks and tips that you can apply to melt away the years and start feeling and looking young and beautiful again. Here are some of my favorite makeup tricks and tips for just that purpose. Rosy Lip Hues Rosy lip hue is perfect because it gives you......