Dealing with Microsoft PowersHell

| October 20, 2011 | 3 Replies

Why, one may wonder, would I be delving into something that ubiquitous Microsoft decides unabashedly to call PowersHell? To start with, and in full disclosure, they capitalize it as PowerShell, a new and improved version of the command line interface that we old timers sometimes still call the DOS prompt.

But why would I use this, when the Gooey does so much? It has to do with too many cameras and too many memory chips. You see, I just went on vacation, a two week, 3,550 mile drive to Yellowstone, the Tetons, and many places in between. I brought home over 4,000 snapshots and video clips taken with 4 cameras.

Why would anyone need 4 cameras? Well, I have a SuperZoom 12Mp, and a pocket camera (the SD1100 that we’ve raved about), and my new Droid. That’s three? Well, I also got a back-up SD1100, that I’ve also rigged up with my first to use as a stereo camera.

So with three of the four cameras all of the same brand, and so many pictures, eventually the 8 character file names (the first four of which are fixed in 3 cameras as “IMG_”) began to overlap. And when I filled up a memory chip, each camera decided to reset to IMG_0001, so I have many overlaps in the lower numbers. Very clumsy. Also it is hard to match up the images from the left and right cameras (each eye stored in its own folder) without looking at each enlarged, and the Windows Photo Viewer doesn’t let me look at two files from different folders side-by-side.

So I decided to rename all the images to use longer names, and decided to use the picture date and time to rename them. My former XP machine had use a nice re-namer that would do this. But now I have Win7, and the old Win95 app won’t run.
But I keep in mind that “Every O/S Sucks”

So I Googled for a new renamer that could handle the task, and stumbled on to this post: Rename multiple files as “Modified Date/Time” using cmd or Powershell. Yee, I thought, Haw! Why install another utility when the O/S does it for me.

But it can’t be done with the old command line. One has to figure out how to use the new, powerful, dangerous PowerShell. I could have just used the code snippet in the Super User post linked above. But I wanted to, a) Know how it works, and b) Do it a little differently.

So once I returned, I did some reading, and playing. But after a minimum of profanity, I got it working on a test folder, and then ran my new script on all my files. Now I can tell at a glance when each picture was taken, and therefore easily glean the where and why.

Just for a laff, here’s a bit about the code name Microsoft used while developing this new shell:

Click to see readable original

Share

Category: computers, photography, Reference Sites, Software, Whimsy

About the Author ()

A convoluted mind behind a curly face. A regular traveler, a science buff, and first generation American. Graying of hair, yet still verdant of mind. Lives in South St. Louis City. See his personal website for (too much) more.

Comments (3)

Trackback URL | Comments RSS Feed

  1. Niklaus Pfirsig says:

    Dan, the folks at Microsoft just don’t seem to get “it” where the topic of scripting is concerned. They were close with the batch files in Windows 2000 that had scripting almost comparable with the unix shell. Then they starting pushing wsh with jscript or vbscript, which were good for use in web page scripting, but really suck as general purpose scripting languages.
    Now they have powershell, with it’s long hyphenated commands thrown into the mix.

    I simply install perl, and it works. Perl scripts that ran under windows 95 work just as well with the perl interpreter for Windows 7.

    Maybe it’s just me, but I think Microsoft’s attempts at scripting languages have a Rube Goldberg quality. Find the most complex way to do a simple task.

  2. Dan Klarmann says:

    Yeah, I translated a couple of my XP utilities from VB6 to Perl to avoid installing VB yet again on my Win7 Quad core box. I considered writing a renamer in Perl, but I’ve already invented that wheel. PowersHell was a new road for which to invent the renamer wheel, a challenge.

  3. Niklaus Pfirsig says:

    I have an old Garmin iQue that I bought a few years ago for geocaching. It is basically a Palm pilot with a GPS. Thee coordinates are stored on the device in the address book, encoded as a long hexadecimal string.

    After a bit of googling turned up a 300 line vbscript program that could pull info from the xml formatted gpx files and output vcard entries which could be synced to the iQue.

    Since I use linux at home, I wanted to rewrite this in perl, and after studying the code, I found that about 120 lines made up the conversion. It became apparent that most of the 120 lines were needed to work around the weak math abilities of vbscript. I scrapped the idea of recoding the program but using info referenced in the vb sctipy, was able to write a perl script for my use in about 30 lines of code with the actual coordinate conversions in a 6 line subroutine.

Leave a Reply


Notify me of followup comments via e-mail. You can also subscribe without commenting.