Scripting Blog [archived]

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

Hey, Scripting Guy! How Can I Use a File Mask When Renaming Files?

(image) Hey, Scripting Guy! How can I change file names using a file mask? You know, like when you run the command-line command ren ??x???p?.* ?a????bc.x??.-- AM (image) (image) (image) Hey, AM. Well, the big news out of Seattle is that the Mariners have fired their general manager, Bill Bavasi; that’s to be expected when you spend $...

Hey, Scripting Guy! How Can I Compare Two Strings Values and Then Report Back the Result of That Comparison?

(image) Hey, Scripting Guy! I need to write a command-line script that, given two arguments, can compare the two values and then – using standard errorlevel – report back whether string 1 is greater than or less than string 2, or if the two strings are identical. Can you help me with that?-- JP(image) (image) (image) Hey, JP. You know...

Hey, Scripting Guy! How Can I Separate The Month From the Year in a Date String Like 122007?

(image) Hey, Scripting Guy! I have a column of data in Microsoft Excel that is formatted as MYYYY (12008 = January 2008) and MMYYYY (122007 = December 2007). I need to split these values into month and year, but I can’t figure out how to do that. Any suggestions?-- DW(image) (image) (image) Hey, DW. Well, it’s finally beginning to warm...

Hey, Scripting Guy! How Can I Extract Three-Digit Numbers From a String?

(image) Hey, Scripting Guy! I’m trying to use regular expressions to extract three-digit numbers that are enclosed by pipe characters; they embedded in string values like this: |159|468|572|843|. However, I can’t figure out the syntax that will get this to work. Can you help me?-- RS (image) (image) (image) Hey, RS. Before we ...

Hey, Scripting Guy! How Can I Replace Text That Includes Double Quote Marks and a Tab Character?

(image) Hey, Scripting Guy! I read one of your columns on replacing text in a file and I found it very useful. However, I have a somewhat more-complicated need: I want to replace text that includes both double quote marks and a tab character. How can I do that?-- FC(image) (image) (image) Hey, FC. Your know, as anyone who’s ever read Hey...