Archive for the ‘Tips & Tricks’ Category

Disable Windows Update P2P distribution

August 1, 2015

This setting seems to be controlled by a value called DODownloadMode:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config]
"DODownloadMode"=dword:00000000


You should probably reboot after changing this or just manually turn the feature off in the settings app…

Advertisements

Disable Cortana web results

July 31, 2015

I’m never going to type in basic internet search queries in Cortana so there is no point in cluttering the results with useless garbage, this is how you disable it:

The basic UI setting is controlled by this value:

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Search]
"BingSearchEnabled"=dword:00000000

If you really want to kill Cortana you can set various group policies:
(more…)

The application directory bundle shell hack

August 14, 2011

In the words of the great Raymond Chen: In Windows, the directory is the application bundle but that is a poor excuse for the lack of some kind of application bundle or fat binary support. I usually don’t care about eye candy but it would be nice (and a fun experiment) if we could get a application directory to look and act like a real application bundle. (more…)

Run, script, run!

March 1, 2011

You would think a scripting engine that has a separate console version (cscript.exe) would allow you to execute an external command/application and handle basic stdout output for you with a simple command, but sadly this is not the case. WScript.Shell’s Run method uses ShellExecute and unsurprisingly so does Shell.Application’s ShellExecute, that just leaves us with Exec.

This is what MSDN has to say about this method:

Runs an application in a child command-shell, providing access to the StdIn/StdOut/StdErr streams.

Sounds good right?
(more…)

Self incrementing version define

November 16, 2010

Thanks to JScript’s conditional compilation feature it is possible to execute code in comments, this allows you to create valid c header files with embedded JScript. This can come in handy in a custom build step

/*@cc_on@*//*@if (!@_jscript)@
============================*/

#define APPVER_BLD 1

/*============================
@else 
var FSO=new ActiveXObject("Scripting.FileSystemObject");
var lines=[],hF=FSO.OpenTextFile(WScript.ScriptFullName,1,false);
for(;!hF.AtEndOfStream;){lines.push(hF.ReadLine());}hF.Close();
if (lines.length) {
	hF=FSO.OpenTextFile(WScript.ScriptFullName,2,false);
	for(var line,i=0;i<lines.length;++i) {
		if (((line=lines[i]).indexOf("#def"+"ine"))!=-1) {
			line=line.split(" ");
			line[2]=parseInt(line[2])+1;
			line=line.join(" ");
		}
		hF.WriteLine(line);
	}
}
@end @*/

The bastard love child of BAT and WSH

November 4, 2009

The (default) PATHEXT environment variable contains .vbs/.js/.wsf but wscript.exe is usually set as the default windows scripting engine host, so running scripts in a terminal is a big pain. What if we could put the WSH script inside a batch file so we don’t have to prefix every call with cscript //nologo ?
(more…)