Scripting Blog [archived]

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

How Can I Sort the Contents of a Text File?

(image) Hey, Scripting Guy! I have a text file that contains a list of computer names. How can I sort that file alphabetically?-- LR(image) (image) (image) Hey, LR. If we wanted to take the easy way out weโ€™d just tell you, โ€œSorry, you canโ€™t do that.โ€ And we could get away with that because none of Microsoftโ€™s scripting ...

How Can I Write Binary Data to the Registry?

(image) Hey, Scripting Guy! How can I write binary data to the registry?-- FG(image) (image) (image) Hey, FG. WMIโ€™s Standard Registry Provider includes a method - SetBinaryData - that makes it relatively easy to write binary data to the registry. Thereโ€™s one little catch to be aware of, but weโ€™ll let you know what that is. First, ...

How Can I Read Text From a File and Then Rename the File Using the Text I Just Read?

Guy! I would like to be able to open a file, read the first 10 characters, and then rename the file to those 10 characters plus a .txt file extension. How can I do that?-- KA(image) (image) (image) Hey, KA. Ah, for once a text file question that can be answered without some weird and convoluted workaround. This is actually pretty easy: we ...

How Can I Tell Whether a Web Page is Accessible?

(image) Hey, Scripting Guy! How can I tell whether or not a Web page is accessible?-- JW(image) (image) (image) Hey, JW. To tell you the truth, these are the kinds of questions we hate, questions where we donโ€™t know the answer off the top of our heads but where it seems like there ought to be a way to do this. Sometimes in the world of ...