Stopping the Windows Update ‘Restart Now’ Popup with ‘net stop’

Because I always forget:

1) Open a command prompt (Start->Run->cmd.exe)

2) Type “net stop wuauserv” and hit enter.

3) Enjoy no longer getting knocked out of StarCraft 2 while you’re in the middle of your rush.

(Tested in Windows XP, YMMV in other operating systems.)

Recursively add missing files to SVN

Nats showed me this awesome little trick a while back – if you’ve just added a stack of new files to a directory and need to easily add them all into SVN from the command line (for example, if you’ve just unpacked a new WordPress install and there are new files in it that you need to add), you can use the following command:

svn add `svn st $DIR | grep -E '^\?' | cut -b 8-`

Really Simple wget Tutorial

wget is a simple command line-based tool that allows you to download files from the command line. It is a very powerful tool for downloading with a lot of options, but it can also be really helpful in diagnosing common downloading problems.

Unfortunately, as it is a command line tool, it can be daunting for users to use. This post is intended as a really simple reference for people who have been asked to download something via wget and want some step-by-step instructions to follow:

STEP 1: Download wget

a) Go to the wget for Windows page by Bart Puype and look for the wget download link and download it to your computer – preferably to your desktop. If you choose to download it elsewhere, you’ll need to know where you downloaded it to for the next step.

The download link looks like this:


STEP 2: Open a command prompt

wget is a command line utility, which means you can’t just double click on it and have it work. You need to open a command prompt and run it from there.

a) Hit the following key combination: Windows Key and R (that is, hold down the Windows key and hit “R”). A small “run” dialog will open in the bottom left of your screen.


b) In the run dialog, type cmd.exe and then hit the “OK” button:


c) After doing this, a black window will open on your screen looking something like the below:


STEP 3: Find and test wget

By default, your “run” command will have you sitting at your user profile directory. If you followed the instructions above, you downloaded wget.exe into your Desktop directory. Now you need to run the following commands, which you should be able to just type directly (without the quotes):

a) Type “cd desktop” and hit enter to change into the directory in which wget.exe is residing (if you did not download to your Desktop, you’ll need to figure out where you did download it to, and manually change to that directory).

b) To check if wget is working, type: “wget” and hit enter. It should look like the below:


If it does not, then something is wrong and you probably need to start again!
STEP 4: Get your download URL ready

If you’ve gotten this far, wget is correctly installed and ready to be used. All you need now is a URL to download.

A URL is the thing that you are clicking on that starts the actual file download process. When you click on a file download URL, you’ll get that little “save as” dialog in your browser which you then use to tell your browser where to put the file.

a) Instead of left-clicking on the URL you want to test to start the download, right-click on it. You will get a menu that looks like this (in Internet Explorer):


Select “copy shortcut”. Note if you are using a different browser like Firefox the text might be different (Firefox is “Copy Link Shortcut” for example).

STEP 5: Use wget to download a file

Now we have everything we need!

a) Click back to your command prompt window, which should be sitting there ready and waiting.

b) Type “wget” – but don’t hit enter!

c) Hit the space bar, so you have a space after the wget command.

d) In the top left of the command prompt window, there’s a little “C:\” icon. Click that and go through the menu that results until you find the ‘Edit’ submenu, then hit ‘Paste’:


e) If you have copied the link correctly, it should get pasted into the command line prompt, so you should end up with a something on the command line that looks like: “wget”

f) Hit enter! The download will start and information will start spewing to the command prompt showing how fast it is downloading and how long it has left. If you get errors then you might not have pasted the right URL or there might be some other problem.

Unpacking / extracting a .rpm file

I have never figured out the RPM package management system. It’s mostly because I haven’t tried hard, but it still makes me feel like a moron.

Every now and then I stumble across a package that, for whatever reason, is only distributed in .rpm form. Right now I wanted to install nano on’s shared hosting (because I’m also too lazy to learn vi), and the easiest way I could think of was to nab the .rpm and just rip out the nano binary.

Turns out this is really easy from a Linux shell:

# rpm2cpio [rpm filename] | cpio -idv

Another victory for laziness! It spewed out a bunch of stuff, I nabbed the nano binary, threw it on my godaddy shared hosting using wget via ssh, and now I have a fully functional and awesome editor (no matter what anyone tells you).

Downloading Ubuntu Metalinks with aria2c

The v9.04 Ubuntu release happened recently and as always I found myself battling to get the occasional ISO that wouldn’t come down cleanly via BitTorrent.

I thought I’d give the metalink versions a try with aria2c. Unfortunately the Ubuntu defaults to having a ‘maxconnections’ of one – which, as far as I can tell from the metalink spec, means you’ll only make 1 connection to a server (which will probably end up just being the torrent anyway, as it has the highest priority).

If you naughtily download the metalink file you can, of course, edit the resources section in the XML to be whatever maxconnections you want. I feel justified in doing this because a) I don’t think it will duly unburden the servers and b) I’m doing this to reduce the overall load by providing another mirror alternative, but morally I still feel a bit squeamish about it.

Anyway, my download speed went from like several hundred kilobytes a second via BitTorrent only to the following:

[#2 SIZE:409.6MiB/695.8MiB(58%) CN:113 SPD:5017.71KiB/s UP:18.86KiB/s(800.0KiB) ETA:58s]

So, it made 113 connections (a big chunk of them were BitTorrent ones obviously), and I ended up getting the file at around 5mbytes/sec. Nice!

7-Zip / 7z Command Line Compression Method Options

I always forget how to do this and always end up battling Google trying to find the reference for it. This page is a really good reference of all the command line options for 7-Zip, but just for my purposes, here’s how to set the compression method:

-mx0 : No compression (copy mode)
-mx1 : Very low (fastest mode)
-mx3 : Fast compression mode
-mx5 : normal compression
-mx7 : maximum compression.
-mx9 : ultra compression.

cpaste – Command Line Pasting in Windows

I use the command line in Windows all the time, for a lot of different things. Back in 1998, I realised one of my really common operations was to copy a file to the clipboard (using Windows Explorer; either right-click-copy or select the file/folder and hit CTRL-C) and then paste it into a destination folder.

As I always had a command prompt open, I’d often do this by changing to the destination directory, typing ‘start .’ to invoke an Explorer Window in that directory, then hitting CTRL-V. I realised it’d be awesome if I could cut out that ‘start .’ step, and thought a command line tool to allow me to paste files directly would be really handy.

So, I wrote a Win32 command line tool that did exactly that. It was really hacky, but it worked – I’ve used it almost every day since to copy and move files around.

10 years later, I realise I never even put it up for people to download or even offered it to anyone. So, here it is – cpaste for Windows.