Windows


Windows NTFS has a nice but relatively unknown feature called NTFS junctions.  It is like hard links in Unix except it is only for directories.  Microsoft has a KB article about it which points to several utilities.  However I have been using Mark Russinovich’s junction tool exclusively.

Using Junction

Usage: [-s] <directory or file name>

-s Recurse subdirectories

If you want to create or delete a junction, use Junction like this:

Usage: [-d] <junction directory> [<junction target>]

To delete a junction specify the -d switch and the junction name.

Here is an example of using junction.  Note that the order of arguments is opposite of the Unix ln command.

> junction foo d:\docs\foo

The above example will create a junction called “foo” in the current directory.  This junction will point to d:\docs\foo.

To do the same in Cygwin:

$ junction foo `cygpath -aw /d/docs/foo`

One tip is to use the DOS dir command.  It will display <JUNCTION> instead of <DIR> in directory listings for junctions.

Previously I recommended TcpView to help figure out what ports are being used.  But today I was informed of an even better, more informative program called What’s Running.

I am not a big fan of Outlook, I prefer Gmail, but it does have some nice features and in a corporate environment you almost never have another choice.

One of the nice features of Outlook is the ability to color code your messages.  For example you can color code the subject line to highlight messages addressed directly to you via:

Tools > Organize >  Using Colors > Messages sent only to me now appear [Blue] > Turn On

There are other filters you can turn on by clicking on “Automatic Formatting…” at the top right in the Tools > Organize > Using Colors window.

Sometimes I will start up a server process and get an error about a port already in use. This problem always bedeviled me before as I randomly stopped processes until that port was freed up.

But today a colleague pointed out a great Microsoft tool called TcpView.

TCPView is a Windows program that will show you detailed listings of all TCP and UDP endpoints on your system, including the local and remote addresses and state of TCP connections. On Windows Server 2008, Vista, NT, 2000 and XP TCPView also reports the name of the process that owns the endpoint. TCPView provides a more informative and conveniently presented subset of the Netstat program that ships with Windows. The TCPView download includes Tcpvcon, a command-line version with the same functionality.

With TCPView I discovered and stopped the anti-virus program which was taking up one of the ports that the server needed.  This is much nicer than netstat. :-)

In PC World’s January 2008 issue I saw this great tip on how to add “Copy to Folder” and “Move to Folder” to the right-click menu in Explorer.

To save people time I have already created the registry file which you use to merge into your Windows registry to create these menu entries.

As of bash 3.2.9-10, bash no longer executes DOS formatted scripts as detailed in this announcement. I understand the reasoning for this is that:

  1. cygwin is supposed to mimic Linux, not Windows
  2. it is faster to assume that the scripts are in UNIX format

To get around this restriction I did what was recommended in this bug report, i.e. I created a Windows user environment variable named “SHELLOPTS” with the value “igncr”.

After installing Cygwin when I tried to start the shell from a Windows command prompt by entering the “sh” command a window would pop up with this error.

The procedure entry point rl_getenv_hook could not be located in the dynamic link library cygreadline6.dll.

After seeing this error I would have to manually kill the sh process using the Windows Task Manager.

There was a thread about this on the Cygwin mailing list. I did what was suggested and discovered that bin/sh.exe and bin/bash.exe were exactly the same. Yet for some reason when I ran bash from the Windows command prompt I did not get this error.

I then tried rerunning the Cygwin installer. Even though nothing was installed that seemed to solve the problem, i.e. I was able to run sh from the Windows command prompt. This was possibly because the bash postinstall script was run correctly.

Update: After reboot I am experiencing the same problem again. Aargh! :-(

If you want to install Oracle, that great big beast, the computer you intend to install must have a static IP address. However for many people their IP address is dynamic, that is it comes from a DHCP server. To get around this restriction you can install the Microsoft Loopback Adapter which creates a virtual static IP.

To install the Microsoft Loopback Adapter follow these instructions. Note that one way to start the Add Hardware Wizard in Windows XP is to go to the Control Panel and then select Printers and Other Hardware. You should see an Add Hardware entry on the top of the left column.

After installing the Microsoft Loopback Adapter go to the Control Panel, select Network and Internet Connections and then Network Connections. Select the Local Area Connection that is a Microsoft Loopback Adapter. Select the Internet Protocol (TCP/IP) and then press the Properties button. Next select Use the following IP address and enter an IP address that should not conflict with your LAN. I use 192.168.1.200 and set the Subnet Mask to 255.255.255.0.

After you set the IP address you can use the Windows host file to assign a friendly address to this IP address. For example add this entry to C:\WINDOWS\system32\drivers\etc\hosts.

192.168.1.200 cool.example.com

Often when you’re consultant you find yourself stumbling into a LAN with no proper access. IT doesn’t have time to set you up so instead of waiting you have your client friend tell you his login information and then you can start mounting drives from a DOS command prompt like this.

C:\Documents and Settings\fkim>net use z: \\iis1\e$ password /user:domain\username

Occasionally you will see a window popup like this one.

windows error reporting

This happens when a program error or a system error occurs. Windows prompts you to send an error report, theoretically so that Microsoft can use the information to make Windows more robust.

Personally I don’t trust Microsoft so I wanted to turn this off. Fortunately Microsoft provides a way as outlined in this article.

Next Page »