Scripting Blog

A place to learn about PowerShell and share stories of automation

Hey, Scripting Guy! How Can I Compare Files With the Same Name But Two Different Extensions?

Hey, Scripting Guy! After doing several restores we have folders with files named name.doc AND name.do (without "C"). How can we identify such pairs of files and do something to them based on a comparison?-- TN Hi TN, Scripts like the one we’ll develop in this article are the best tools I know of for dealing with this sort of problem. ...

Hey, Scripting Guy! How Can I Load a Drop-Down List From a Text File?

Hey, Scripting Guy! I have a text file that has a list of different store numbers and I would like to be able to populate a drop down list of an HTA.-- MH Hi MH, The basic task of reading data from a text file and using it to populate a drop-down list is pretty straightforward. Below is the code for an HTML Application (HTA) that does just ...

Hey, Scripting Guy! How Can I Read the MAC Address From a Text File?

Hey, Scripting Guy! I've been asked to create a script which will read the contents of addresses.txt and output ONLY the MAC addresses listed in the text file. Could you give me some pointers or even a demo script with which to give me a boost?-- FR Hi FR, The last time someone asked the person writing this column for a boost, the result ...

Hey, Scripting Guy! How Can I Replace a Series of Variables Found in a Text File with Values Taken From That File?

Hey, Scripting Guy! I have a text file containing TSQL syntax. In this file are a number of variables: @P1, @P2, @p3, and so on, up through @P58. The bottom line of the text file contains replacement values for these variables; for example, I need to take the variable @P1 and replace it with the first value in the last line; I need to ...

Hey, Scripting Guy! How Can I Summarize Information Found in a Spreadsheet Row?

Hey, Scripting Guy! I have an Excel spreadsheet that tracks daily time for our employees, indicating whether the employee worked on a given day or took some type of leave (paid leave, leave without pay, sick leave, etc.). Is there a way to output a report showing the various leave types taken by each employee, along with the dates those ...

Feedback usabilla icon