Scripting Blog [archived]

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

Hey, Scripting Guy! How Can I Select Text in a HTA and Then Append That Text to a File?

(image) Hey, Scripting Guy! I read your column about the HTA that could load and then display all the files in a folder. That was pretty useful, but I had an idea to make it even better. When looking at a log file I often see portions of the log that I’d like to copy and save to a separate text file. Is there any way to highlight text ...

Hey, Scripting Guy! How Can I Read Computer Names From a Text File and Then Verify Whether or Not Those Computers Still Exist?

(image) Hey, Scripting Guy! How can I read a list of computer names from a text file, and then check to see if those computers still exist in Active Directory?-- CL(image) (image) (image) You know, that’s a good question, CL, we – hold on a second. Some of you out there look so sad; why the long faces? After all, the 2008 Winter ...

Hey, Scripting Guy! How Can I Sort the Contents of a Text File in Numerical Order?

(image) Hey, Scripting Guy! I have a text file in which each line begins with a number. How can I sort the contents of that file by those numbers?-- KT (image) (image) (image) Hey, KT. Tell you what: we’ll go ahead and answer your question. However, in return, you have to promise to forget everything we tell you. (Which is usually not ...

Hey, Scripting Guy! How Can I Synchronize a Text File of Folder Names With the Subfolders in a Folder?

(image) Hey, Scripting Guy! I have a script that reads through a text file and then checks a folder to see if all the subfolder names listed in that text file actually exist. (For example, if the parent folder is C:\Scripts the script might check to see if a folder named Test Folder – that is, C:\Scripts\Test Folder – actually exists.) ...

Hey, Scripting Guy! How Can I Use Windows PowerShell to Replace Characters in a Text File?

(image) Hey, Scripting Guy! Using Windows PowerShell, how can I replace all the asterisks in a text file with some other character?-- RC (image) (image) (image) Hey, RC. You know, a lot of people ask the Scripting Guy who writes this column, “How do you do it? How do you manage to write a new column each and every day?” (Of ...