Running Komodo Edit Open Source Code Editor Under Windows 7

The open source version of Komodo’s code editor and development environment Komodo Edit is a great tool for development. I use it for PHP, HTML, JavaScript and more.

However, I haven’t done any serious coding for a while so I haven’t needed to run it under Windows 7 even though I had it installed. When I did, I was disapointed to find it behaving very poorly. It wouldn’t resize properly without messing up the screen. I tried with some of the compatibility settings that Windows 7 gives you but that made no difference. I also tried an upgrade to the latest version.

A quick search didn’t reveal anything about Windows 7 specifically but I did spot a discussion about problems under Vista that were related to file permissions. Sure enough, making Komodo Edit run as Administrator fixed the issues.

I’ve had a few file permission issues under Windows 7, I’m fairly sure it is down to me messing around. However, it is clear that Windows Vista and Windows 7 are both rather sensitive to permissions issues which is worth bearing in mind.

Looking at %USERPROFILE%\AppData\Roaming\ActiveState\KomodoEdit, I could see that SYSTEM, my user and Administrators all had full access but that Administrator was the owner of some of the files. I can only summise that this is the issue.

As this needs rebuilding with Windows 7 RC, I haven’t the time to test further but certainly running as Administrator does the trick.

By the way, Komodo Edit is available for Mac and Linux as well as Windows. It has a big brother “Komodo IDE” with additional features if you need them. Both are highly configurable, support many languages and are based on the Mozilla code (like Firefox and Thunderbird) & can easily be extended with JavaScript.

Technorati : , , ,
Diigo Tag Search : , , ,

How-to show a Message of the Day (MOTD) at the Windows Command Prompt

One of the features available under UNIX is the Message of the Day (MOTD). This is run every time you start a command prompt and displays the content of a file. In addition, the UNIX shells allow all sorts of stuff to be run and configured every time you start a new prompt using the .profile and .bashrc command files.

Windows users don’t generally expect that kind of flexibility from their command prompts. However, Windows does indeed support the use of an “autorun” into which you can shoe-horn any command you like.

So for my standard setup, I make the shell autorun run a “.profile.cmd” file that sits in the %USERPROFILE% folder. From that file, I can run anthing I like.

To set up a shell autorun, you have to edit the registry so the usual warnings to be careful and back things up apply. There are two locations you can set, one for the machine as a whole and one for the logged-in user.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor

HKEY_CURRENT_USER\SOFTWARE\Microsoft\Command Processor

If you want to set an autorun for another user, you need to go down HKEY_USERS and find the appropriate one, it’s really easier just to log in!

In one or both of those locations, add a new “String Value” (REG_SZ) called “AutoRun” with the value:


Now create that file and put in a message such as:

@echo "Hello and welcome to my command prompt"

Save the file and open a new shell and you should see the message just after the Microsoft copyright.

This should work on all versions of Windows at least from XP onwards.

If you want to add this to a batch file to set up new machines, here is the command you need:

reg.exe ADD "HKLM\SOFTWARE\Microsoft\Command Processor" /v AutoRun /t REG_SZ /d ^%USERPROFILE^%\.profile.cmd /f

(Note that the above needs to go on a single line)

Technorati : , , , , ,
Diigo Tag Search : , , , , ,

How-to use WebDAV on Windows Vista and Windows 7

Windows is supposed to have a built-in WebDAV client. However, it doesn’t ever seem to have been especially robust and certainly since Vista a lot of people (myself included) have found that it simply doesn’t work on many supposedly WebDAV enabled sites.

Thankfully there are a couple of free (and some not free) options that, while not as nicely integrated into Windows Explorer, do enable you to transfer files back and forth.

The two that I found were:

I’ve tried the first of these two and it seems to work OK. It’s not polished but it gets the job done. There is also an online version using a Java plugin if you don’t want to install the client.

It seems that the second option is no longer in active development. Don’t be fooled by the web site though, they have changed the license to freeware.

Now, at last, I can once again load multiple files to our corporate intranet on WebEx without having to switch to a Linux desktop!

UPDATE 2012-06-20: Further research shows that Windows 7 (and Vista) can be made to work.

The trick is to use digest authentication instead of basic authentication on the WebDAV server. The problem then being that it may no longer work with pre-Vista clients. It is possible that you would need to set up two virtual links to the same folders, on with basic authentication for pre-Vista clients and one with digest authentication for Vista/Win7 clients.

It is also worth noting that is supposed to fix this issue for Vista but shouldn’t be applied to Windows 7. has some additional information on making Windows 7 recognise WebDAV servers that only have basic authentication available. However, this requires admin access on the client PC.

Technorati : , ,
Diigo Tag Search : , ,

Keeping Control: File and Folder Links for Windows Users

A good backup strategy for any computer involves keeping control of where stuff is stored. The fewer locations that contain files that change, the fewer locations have to be maintained.

UNIX users have always had the ability to keep things wherever they wanted and then to LINK that information into the required location. Basically, links create a link or tunnel between one file or folder and another. Most of the time, you will not notice that you’ve entered a tunnel and you are not interested really.

Windows users, however, have always been the poor cousins here. Stuck as we were in FATland, we had no access to fancy features such as links. So Microsoft in their inimitable fashion created a poor-man’s link – the Windows Shell Shortcut – so that the Windows GUI had some minimal capability (really only for menu’s and Windows Explorer).

Windows 2000 improved on this by introducing “Reparse Points” one form of which is the “Junction“. This is an extension to NTFS that allows folders to be joined (linked) to another location in the local volume space. Making junctions is not an obvious process, you can do it from the disk manager and there is a tool in the Windows 2000 server resource kit called linkd. The POSIX tools included in the resource kit contain the UNIX command ln which can also create junction points and hard links; fsutil in XP can also. There are some third party tools too.

It’s odd because I seem to remember that OS/2 had some kind of linking feature.

Anyway, links of the UNIX type are a massively useful feature that has finally (with Vista, Windows 2008 and beyond) made it fully to NTFS and Windows.

Vista, Windows 2008 and Windows 7 all have a command line tool called mklink. This can be used like the Unix ln command to create both hard links (which must be on the same volume) and soft links. Soft links under Windows can, in fact, span across SMB network drives as well.

You might also like to look at another free tool called “Link Shell Extension” by Hermann Schinagl. This integrates into Windows Explorer, the web site also has a more complete explanation of the history of links in Windows. LSE does a number of clever things and is well worth a look. Hermann also has a “dupmerge” tool on his web site that will replace duplicated files with hard links.

So now, if we want to tweak the HOSTS file for example (c:\windows\system32\drivers\etc\hosts), we don’t need to leave in place since that would mean that we would need an extra backup routine. Instead, copy it to somewhere that already gets backed up. Delete the original file and then from the command line:

mklink c:\windows\system32\drivers\etc\hosts %USERPROFILE%\BACKUPS\hosts

Now you can edit the hosts file from either location, there is only one file (in %USERPROFILE%\BACKUPS). The difference being that even if you delete the file from its normal location, it will still exist in the “real” location. If you delete it from its “real” place in BACKUPS of course, the link will be broken and wont work.

To link a complete folder, it is the same command with a /D parameter added. For example, I keep a folder of command line utilities such as ls, ssh and rsync in a folder on a USB pen drive. I sync that folder to the BACKUPS location on my hard drive for convenience but I need the folder in my PATH otherwise its hard to execute the utilities. I don’t want a really long path, it’s bad enough already, so I link the folder to c:\cmd with the following:

mklink /D c:\cmd %USERPROFILE%\BACKUPS\PEN\cmd

Now I add c:\cmd to the path and the utilities seem to be in both places.

I’ve said in other posts that I like to reinstall Windows now and again but it can be a pain to restore all of the document files. Similarly, if you keep multiple operating systems on your hard drive, how do you keep your documents sorted? One way is to put all documents, videos, music, etc. onto a separate partition. Now, instead of going mad with the Windows registry trying to relocate your normal documents folders to another drive. Simply delete the normal documents folder – %USERPROFILE%\Documents\ under Windows 7 and relink it to the appropriate folder on the other drive as so:

mklink /D %USERPROFILE%\Documents d:\Docs

Put this in a script that you run when you reinstall Windows and its easy and quick.

One final note. You may find a few pieces of software that cannot cope with links. Certainly Subversion cannot though Bazaar can. Windows Explorer seems OK though as do utilities such as RSYNC.

Technorati : , , , , , ,
Diigo Tag Search : , , , , , ,

How to get and use your local IP address in a Windows 7 (and Vista) batch command file

If, like me, you spend a lot of time on a variety of customer sites, you will probably be familiar with the issues around swapping networks.

I’ve already blogged about the problems with Windows 7, Vista and Firefox proxy settings and I will do some more articles on getting on with problematic proxies later. However, I wanted to let people know how to get hold of your IP address from within a batch (command) file.

@REM ipconfig | find "IPv4 Address"
@REM Find the IPv4 address from ipconfig (13th var if string is split by both @REM and space)
@for /f "usebackq tokens=13 delims=: " %%i in (`ipconfig ^| find "IPv4 Address" `) do @(
   @set MyIP=%%i
   @REM Split addr into components so networks can easily be checked
   @for /f "usebackq tokens=1-4 delims=." %%a in ('%%i') do @(
      @REM @echo %%a,%%b,%%c,%%d
      @set MyIP1=%%a
      @set MyIP2=%%b
      @set MyIP3=%%c
      @set MyIP4=%%d

Note the space after the : on line 3. The FOR command used twice here splits the text output from what is in the () after the “in” using the defined delimiters (“:” and space in the 1st case, “.” in the 2nd). In the first FOR statement, we take element number 13 only, it ends up in variable %%i. In the second case, we take elements number 1 to 4, they go into variables %%a, %%b, %%c, %%d.

Now you have not only the full address but also the componants so if you wanted to check whether you were in a particular class C network, you could do something like:

@set corp_addr_ip4=

@if "%MyIP1%.%MyIP2%.%MyIP3%.0"=="%corp_addr_ip4%" @goto DOSOMETHING

That would check if your local IP address is between and

Note that I’ve used the enhanced FOR statement – the “usebakq” makes the FOR statement more like a UNIX type one where commands are enclosed in back-quotes (`). This certainly works for Windows 7 and should, I think, work for Vista. Prior to Vista, you would need to do things differently anyway. At the very least you would have to search for “IP Address” in the FIND statement as IPCONFIG didn’t include IPv6 information.

Now that you have everything in place, you can control the proxy settings for each application that needs access out of the local network. I’ll blog about that another time.

Technorati : , , ,
Diigo Tag Search : , , ,

proxy.pac files, Mozilla (Firefox & Thunderbird) and Vista or Windows 7

I’ve found a problem with Mozilla based products and proxy settings.

To automatically configure a proxy for use by Internet browsers, you can use a file called “proxy.pac“. This is a JavaScript function that is loaded into the browser when it starts and redirects requests via a proxy where required.

All of the descriptions for this file you will find on the Internet will provide the following example of checking your current IP address. This is used for laptops where the IP address will change depending on where you are. You can check when the laptop is on the corporate network and redirect requests via the corporate proxy as needed:

if ( isInNet(myIpAddress(), "", "") ) {
  alert("Corporate address & proxy");
  return "PROXY";

Well, this does not work for Mozilla based applications (for example Firefox and Thunderbird) if you are using Microsoft Vista or Windows 7.

That is because, under those operating systems, the internal function myIpAddress() does not return an IPv4 address as expected (e.g. but an IPv6 address instead (e.g something longer with lots of “:”).

In order to make your proxy.pac file work with both IE and Mozilla, use something like:

if (isInNet(myIpAddress(), "", "") ||
            shExpMatch(myIpAddress(), "fe80::b892:6a74:9635:*") ) {
  alert("Corporate address & proxy");
  return "PROXY; DIRECT;";

You can discover your IPv6 address in several ways but the trusty command line “ipconfig /all” shows you everything you need.

See also this discussion on the Mozilla support forums: proxy.pac myIpAddress() returns incorrect format? : , , ,
Technorati : , , ,
Diigo Tag Search : , , ,