powershell idiosynchrosies

issues with dir / get-childitem with -include and -recurse

So, I have a directory “c:\utils” that shows this when I ‘dir’:

Mode                LastWriteTime     Length Name
----                -------------     ------ ----
-a---        02/01/2008     17:03        480 autoruns.lnk
-a---        02/01/2008     17:04        475 Console.exe.lnk
-a---        02/01/2008     17:05        475 procexp.exe.lnk
-a---        03/01/2008     16:49        621 Regulator.lnk
-a---        02/01/2008     17:06        643 runemacs.exe.lnk
-a---        02/01/2008     17:05        475 Tcpview.exe.lnk
-a---        02/01/2008     17:05        475 WinDiff.Exe.lnk

I want to a listing which just shows the files with extensions .exe.lnk, ie:

 Mode                LastWriteTime     Length Name
 ----                -------------     ------ ----
-a---        02/01/2008     17:04        475 Console.exe.lnk
-a---        02/01/2008     17:05        475 procexp.exe.lnk
-a---        02/01/2008     17:06        643 runemacs.exe.lnk
-a---        02/01/2008     17:05        475 Tcpview.exe.lnk
-a---        02/01/2008     17:05        475 WinDiff.Exe.lnk

These commands work and return what I want:

dir *.exe.lnk
dir -filter *.exe.lnk
dir * -include *.exe.lnk
dir -include *.exe.lnk -recurse

These commands return nothing:

dir -include *.exe.lnk
dir . -include *.exe.lnk
dir c:\utils -include *.exe.lnk

unless there’s a bug here it just seems too unintuitive and overly-pedantic.

powershell and the setenv.bat pattern

Having been aware of the monad initiative for the past few years but not having played with it until recently, I must say that I’ve been initially disappointed arising from two main shortcomings:

  1. command line editing – notwithstanding the tab completion support for the built-in powershell commands, navigating and editing back and forth across a command line is exactly as cumbersome as it ever was – ie exactly as per cmd.exe. Read more of this post

back to windows

I moved back to windows from ubuntu 7.10 on my dev laptop for reasons I may go into another time. Curiously, the significant discomfort I’m currently experiencing with windows is uncannily similar to the experience of moving in the other direction a couple of years ago (daycoder apathy ensures my opinions are not coloured by any prejudices). But I’m sure that if I persist I will eventually acclimatise and appreciate. Read more of this post