Scripting Blog [archived]

Formerly known as the "Hey, Scripting Guy!" blog

Hey, Scripting Guy! How Can I Extract a User Name and Drive Name From a String Value?

(image) Hey, Scripting Guy! We currently have user home directory information stored in this format: kenmyer on 'atl-fs-001\vol' (U:). How I can extract the user name and drive letter and change the format to this: U:\kenmyer?-- AR(image) (image) (image) Hey, AR. Well, it’s Monday, day 1 of the TechEd IT Forum, and the Scripting Guys ...

Hey, Scripting Guy! How Can I Convert an Extension Number to an Actual Phone Number?

(image) Our phone numbers are stored in Active Directory as extension numbers; however, we have a set of rules for converting those extensions to actual phone numbers. I’m writing a script to create an Outlook signature, but in that script I need to be able to convert an extension to a phone number. How do I do that?-- SM(image) (image) (...

How Can I Remove All the Non-Alphabetic Characters in a String?

(image) Hey, Scripting Guy! How can I remove all the non-alphabetic characters in a string?-- CD(image) (image) (image) Hey, CD. You know, typically the Scripting Guys don’t play favorites; we treat all our readers and all the questions we receive exactly the same. (OK, so, technically that means that, for the most part, we simply ignore...

How Can I Delete Specified Characters From the Beginning and End of My File Names?

(image) Hey, Scripting Guy! How can I truncate file names by removing a common beginning and ending, leaving only the unique middle portion of the name?-- RE (image) (image) (image) Hey, RE. Before we answer your question we’d like to point out that we’ve finally posted the winners of the Scripting Guys TechEd Challenge. (If you are a ...

How Can I Locate a Value in a Text File and Then Parse the Line of Text Where the Value Was Found?

(image) Hey, Scripting Guy! How can I open a CSV file, locate a value in column 1, then store the value in column 2 in a variable?-- THvdH(image) (image) (image) Hey, HvdH. We have to be honest with you, it’s a little difficult for the Scripting Guy who writes this column to stay focused on his work today. After all, tomorrow is one of the...