Scripting Blog [archived]

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

How Can I Use a Wildcard Character to Delete Folders?

(image) Hey, Scripting Guy! How can I delete folders based on a wildcard character? For example, how can I delete all the folders whose name starts with December?-- RR(image) (image) (image) Hey, RR. Well, that depends. If you’re running Windows XP or Windows Server 2003, you can actually use a wildcard character to identify and then ...

How Can I Change the Working Folder of a Script?

(image) Hey, Scripting Guy! My script needs to have the same working folder as the application that the script starts. How can I change the working folder of a script?-- JM(image) (image) (image) Hey, JM. You can change the current (or working) folder of a script simply by setting the value of the Wscript Shell object’s CurrentDirectory ...

How Can I Determine the Next Available Drive Letter on a Computer?

(image) Hey, Scripting Guy! How can I determine the next available drive letter on a computer?-- TW(image) (image) (image) Hey, TW. Interesting question, and one that crops up from time-to-time. In the old days, when users only had drives A, B, and C, this was easy; you could pretty much guess that any drive letter other than those three ...

How Can I Tell if a Folder Has Any Files with a Specific File Extension?

(image) Hey, Scripting Guy! How can I verify whether or not any files with a specific file extension exist in a folder?-- GM(image) (image) (image) Hey, GM. This is actually a pretty easy thing to do. All we have to do is write a WMI query that includes the path of the folder we want to check as well as the file extension we’re checking ...