What is this svchost.exe (LocalServiceAndNoImpersonation) using all my CPU?

If you've got Win7 you can find out which actual service is using your CPU via the Resource Monitor, ResMon.exe.

On the CPU tab, the second frame down is "Services" You can right-click on the offender and stop it. Often a stop and restart will fix it, at least till next time.

svchost.exe (LocalServiceAndNoImpersonation) using about 30% of core i5..

I want to set a Windows Environment Variable for my whole user login session

Use setx to permanently set an environment variable

If you've used windows environment variables at all, you've probably wished you could set them in a command window for use in another program.
You can't change the environment of an already-running program - the environment is copied when a program starts - but you can set environments values for your user session that will be picked up by any new programs you launch with setx:

setx myvariable thenewvalue

Much easier than right-clicking to get to My Computer properties.
setx /? will also tell you about setting permanent, machine-wide and remote machine environment values.

setx comes with Windows 7 or in the Windows Resouce Kit.

How to unset a variable set with setx

setx myvariable ""

See http://support.microsoft.com/kb/195050 for more details.

A no-code routing service using .Net 4 on IIS

A year ago I was working with Waheed Hussain who pointed out that the .Net framework includes a Routing namespace which allows you to implement a service router with zero code. Literally. It's an IIS application with no code, just a web.config. Here's an example:

< ?xml version="1.0"?>
<configuration>
	<system.serviceModel>
		<routing>
			<filters>
				<filter name="MatchAll" filterType="MatchAll" />
			</filters>
			<filtertables>
				<filtertable name="MyFilterTable">
					<add filterName="MatchAllFilter" endpointName="MyDestinationEndpoint" priority="0"/>
				</filtertable>
			</filtertables>
		</routing>

		<services>
			<service behaviorConfiguration="routingConfiguration" name="System.ServiceModel.Routing.RoutingService">
				<endpoint address="destinationUrl/" binding="basicHttpBinding" name="routerEndpoint1" contract="System.ServiceModel.Routing.IRequestReplyRouter" />
			</service>
		</services>

		<client>
			<endpoint name="MyDestinationEndpoint"
					  address="https://Destination.1.Host.com/destinationUrl/"
					  binding="basicHttpBinding"
					  bindingConfiguration="basicHttpBindingWithClientCertificate"
					  behaviorConfiguration="clientEndpointCredential"
					  contract="*" />
		</client>

		<behaviors>
			<servicebehaviors>
				<behavior name="routingConfiguration">
					<routing routeOnHeadersOnly="true" filterTableName="MyFilterTable" />
					<servicedebug includeExceptionDetailInFaults="true" />
					<servicemetadata httpGetEnabled="true"/>
				</behavior>
			</servicebehaviors>
			<endpointbehaviors>
				<behavior name="clientEndpointCredential">
					<clientcredentials>
						<clientcertificate storeName="My" 
                               storeLocation="LocalMachine" 
                               x509FindType="FindBySubjectName" 
                               findValue="MyClientCertificate" />
					</clientcredentials>
				</behavior>
			</endpointbehaviors>
		</behaviors>

		<bindings>
			<basichttpbinding>
				<binding name="basicHttpBindingWithClientCertificate">
					<security mode="Transport">
						<transport clientCredentialType="Certificate"/>
					</security>
				</binding>
			</basichttpbinding>
		</bindings>

		<!-- The clever bit - activate with no code needed -->
		<servicehostingenvironment>
			<serviceactivations>
				<add relativeAddress="Destination.1.Host.com.svc" 
             service="System.ServiceModel.Routing.RoutingService, System.ServiceModel.Routing, version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
			</serviceactivations>
		</servicehostingenvironment>
	</system.serviceModel>

	<system.web>
		<compilation debug="true" targetFramework="4.0" />
	</system.web>

	<system.net>
		<settings>
			<servicepointmanager expect100Continue="false" />
		</settings>
	</system.net>
	
</configuration>

Escape Characters in Windows Command Line

Escape Characters in Windows’ CMD.EXE doesn't entirely work for me. I wanted to embed or escape quote characters in a command line, to give to the binPath parameter of sc.exe to create a windows service. But this contribution from John McNelly in the comments did give the solution:

John McNelly •  Jun 4, 2009 @1:10 pm

You can also use ^ as a line continuation character for readability.
To escape an embedded ” use a backslash, useful with paths within “c:\Program Files” :

sc.exe create Foo ^
binPath= "\"C:\Program Files\foo.exe\" \"C:\Program Files\foo.ini\"" ^
displayName= "Hello, world"

Thanks John.