Scripting Blog [archived]

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

How Can I List the Network Printers For the Logged-On User?

(image) Hey, Scripting Guy! How can I create a logon script that lists the network printers for the logged-on user, then writes that information to a text file?-- RC (image) (image) (image) Hey, RC. You know, the nice thing about coming to work after a few days off is – well, OK, so maybe we can’t actually think of anything nice about ...

How Can I Create a File of a Specified Size?

(image) Hey, Scripting Guy! How can I create a file of a specified size using a script?-- RE (image) (image) (image) Hey, RE. Well, it’s day 2 of the Walla Walla Invitational Baseball tournament, but at the moment the Scripting Guy who writes this column isn’t thinking about baseball; instead, he’s getting ready to head out to the ...

How Can I Use Windows PowerShell to Retrieve Environment Variables and Special Folder Paths?

(image) Hey, Scripting Guy! How can I use Windows PowerShell to retrieve the value of environment variables and the path to a special folder?-- SB (image) (image) (image) Hey, SB. Well, it’s Thursday, which means that the Scripting Guy who writes this column is currently in Walla Walla, WA, which, as Daffy Duck fans all know, is the home...

How Can I Ensure That a User Enters Only Allowed Characters in a Text Box?

(image) Hey, Scripting Guy! I have an HTA which includes a text box where the user must enter a part number. Part numbers must consist of a certain set of characters; how can I determine if a user entered an invalid character in the part number text box?-- RR (image) (image) (image) Hey, RR. You know, with one exception, no one has ever ...

How Can I Insert a Page Break in a Text File After Each Line Where the Only Character is the Number 1?

(image) Hey, Scripting Guy! How can I open a text file and insert a page break after each line where the only character is the number 1?-- JR (image) (image) (image) Hey, JR. OK, to begin with, there’s no doubt that the Scripting Guy who writes this column doesn’t keep up with the world of fashion; for example, he considers “getting ...