Blog Post

Creating a HEAD utility for Windows 10

,

One of the things I did often in my first career job was create utilities that we could use as a network support team. I was an intern coming from university, where I used SunOS and Solaris all the time. I was used to a command line for a lot of work. While DOS worked well, there were things I missed, like whoami, head, tail, etc.

I rebuilt a bunch of those as DOS batch files for myself, but I expanded this to more useful things. We supported over 1000 people, and finding their phone extensions was a pain, especially in the early 1990s with phones that had cords and pagers. We had a common file share that contained a text phone directory, so I built 411.bat, which took a parameter and searched that file for a matching name. Then returned the line of data. It was immensely helpful to us.

The other day I had a large file that I wanted a glimpse of. I opened it in Notepad++ (this was GBs of data), but it took time. That made me think I’d really like HEAD on Windows. I tried it, but it’s not there.

So I built it. This is my command file:

powershell “get-content %1 | select-object -first 10”

I save this in a utilities folder in my path. Then in other folders, I can run it and get a glimpse of text files I’m importing or working with. Way, way faster than Excel or trying to open this in another program. I often have a cmd open, so this is useful to me. You can see it working below.

2022-08-04 08_55_24-C__utilities

Original post (opens in new tab)
View comments in original post (opens in new tab)

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating