Microsoft Windows Vista Error 0x80070091 and Cygwin

In Windows Vista I installed JBoss.  When I then logged in as another user for some reason all the JBoss directories had no permissions, i.e. their permissions were 000.  I ignored this and went ahead and copied one of the server directories.  Then I tried to go into the copied server directory and could not.

Thinking something was funky I tried to delete the whole JBoss directory but got this maddening and uninformative window.

Microsoft Windows Vista Error 0x80070091

I googled for a long time but could not find a satisfying solution.  I gave myself full control permissions for all files and folders but that did not help.  Then I noticed that if I clicked on one of the directories that Windows Vista was not letting me delete I would be prompted for permission to enter this directory.  Then I would repeat this process for all directories within.  After doing this I could delete that directory.

I then looked in Cygwin and found out what Vista had done, it had simply given the directory read and write permission.

Therefore the simple solution was to do the following:

chmod -R 500 .

After doing that simple change I could remove everything.

NTFS Junctions

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.

Color Code Outlook Messages

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. 🙂

Another nice tool to discover what programs are holding onto files is Process Explorer.

Update Feb 27 2014: Fortunately this still works on Windows 8.0 even though I am not sure if there has been any new development on it since 2011.

Cygwin Bash cannot execute DOS formatted scripts

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”.

Unable to start Cygwin shell from Windows command prompt

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! 🙁

Installing the Microsoft Loopback Adapter

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. You should be able to start the Add Hardware Wizard by selecting Add Hardware in the Control Panel.  In Windows XP if you cannot find Add Hardware in the Control Panel then you can start the Add Hardware Wizard by selecting Printers and Other Hardware in the Control Panel. 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 (usually Local Area Connection 2). Select the Internet Protocol (TCP/IP in Windows XP, TCP/IPv4 in Windows Vista) 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 and set the Subnet Mask to

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.

HOWTO Map a Network Drive Even When You’re Not Logged In

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