Scripting Blog

A place to learn about PowerShell and share stories of automation

How Can I Separate Hours and Minutes in a Date-Time Value?

Hey, Scripting Guy! In determining system uptime I get back a value like 65.75 hours. How can I convert this value to "65 hours and 45 minutes"?-- JM Hey, JM. We’ll see what we can do for you, but we have to be honest: this is a very sad day for the Scripting Guys. Thanks to the baseball playoffs the Scripting Guy who writes this column had...

How Can I Extract the Text Between the Header and Footer in a Text File?

Hey, Scripting Guy! How can I extract the text between the header and footer in a text file?-- LL Hey, LL. Before we answer your question we should point out that, depending on when you’re reading this, you might be missing Day 1 of Windows PowerShell Week. Even as we speak the lovely and talented Jean Ross could be presenting an ...

How Can I Run a Macro After Opening Up Word?

Hey, Scripting Guy! How can I run a specified Word macro after opening Word using a script?-- JD Hey, JD. You know, when they first tested the atomic bomb a number of physicists had legitimate fears that the bomb might set off an unstoppable chain reaction that would end up destroying the entire world. We have to admit that, when we read your...

How Can I Enable System Restore Using a Script?

Hey, Scripting Guy! How can I enable Windows XP’s System Restore using a script?-- RL Hey, RL. Thanks for the question; the Scripting Guy who writes this column is running way late today, the clock is ticking, and he was desperately in need of a question a he could answer without having to use a lot of code. A question about enabling System...

How Can I Keep the Screen From Updating While Running an Excel Script?

Hey, Scripting Guy! I seem to recall that there’s a way to “freeze” the display in Microsoft Excel any time you carry out a lengthy operation; that way the user doesn’t see anything change until the operation is complete. Do you have any idea how I can do that?-- IW Hey, IW. Do we have any idea of how you can do that? Oh, IW, you’ve...