Scripting Blog [archived]

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

How Can I Add Two Blank Lines Between Each Line in a Text File?

(image) Hey, Scripting Guy! Hey, Scripting Guy! How can I add two blank lines between each line in a text file?-- LW(image) (image) (image) Hey, LW. You know, when we wrote the Microsoft Windows 2000 Scripting Guide we included 4 or 5 examples of how you might work with text files. And then we thought to ourselves, “Well, we’ve pretty ...

Why Does My Performance Monitoring Script Keep Returning the Same Incorrect Values?

(image) Hey, Scripting Guy! I’m using a script to monitor process performance, but every time I run the script the percent processor time for all the processes comes out as 0. What am I doing wrong?-- JL(image) (image) (image) Hey, JL. We’ve simplified your script a bit to better illustrate the problem you’re running into. (And don...

How Can I Pass Command-Line Variables to an HTA When It Starts?

(image) Hey, Scripting Guy! How can I pass command-line variables to an HTA when it starts?-- DM(image) (image) (image) Hey, DM. Ok, we admit it: you almost had us on this one. (Not that being able to stump the Scripting Guys is particularly hard, mind you.) We had no idea whether you could pass command-line variables to an HTA, and even ...

How Can I Tell Whether a Group Member is a User, a Computer, or Another Group?

(image) Hey, Scripting Guy! How can I tell whether the member of a group is a user, a computer, or another group?-- ON(image) (image) (image) Hey, ON. Interesting question and - to tell you the truth - one we’d never really thought about. It’s easy enough to list all the members of a group; for example, here’s a script that reports ...