Scripting Blog

A place to learn about PowerShell and share stories of automation

How Can I Use Windows PowerShell to Report Back the Name and Creation Date for Files Containing a Specified String Value?

Hey, Scripting Guy! Using Windows PowerShell, how can I search for a string value in all the files in a folder full of text files, then report back the file name and creation date for each file where that string value was found? Oh, and I’d like to have these files sorted by date, too.-- JS Hey, JS. You know, the Scripting Guy who writes ...

Hey, Scripting Guy! How Can I Copy a Portion of a Microsoft Word Document to a New Microsoft Word Document?

Hey, Scripting Guy! How can I find some text in a Microsoft Word document, copy the rest of the document from that point on, then paste the copied text into a brand-new Word file?-- CB Hey, CB. You know, it’s kind of a melancholic day here at Scripting Guys world headquarters. That’s because the Juanita Rebels were defeated 10-8 in the ...

Hey, Scripting Guy! How Can I Modify a .CSV File and Then Import That File into Microsoft Excel?

Hey, Scripting Guy! I have a comma-separated values file that I need to import into Excel. However, before I do that I need to do some arithmetic and then add an additional field to the CSV file. On top of that, when I import this file I need to format this new field as a date-time value. How can I do that?-- R Hey, R. Well, by now most of ...

Hey, Scripting Guy! How Can I Search for a Word in a Text File and Return the Entire Line Where That Word Was Found?

Hey, Scripting Guy! I have a scenario in which I need to read a list of names from a text file. I then need to search for each of those names in a second text file; if a name is found I need to extract the entire line in which that name appears. I’ve figured out how to search for a name in a text file, but I can’t figure out how to ...

Hey, Scripting Guy! How Can I Identify the 20 Most-Recently Modified Files in a Folder?

Hey, Scripting Guy! I Using VBScript, how can I identify the 20 most-recently modified files in a folder?-- TW Hey, TW. You know, the Scripting Guy who writes this column was just reading – thanks to the magic of Spam email – about a new voice mail service. With this service you don’t have to listen to all those annoying voice mails; ...

Feedback usabilla icon