Scripting Blog

A place to learn about PowerShell and share stories of automation

How Can I Determine the Size of the My Documents Folder?

Hey, Scripting Guy! How can I determine the size of the My Documents folder?-- SC Hey, SC. The My Document folder is actually just another folder on the hard disk, one with a path similar to this: C:\Documents and Settings\kenmyer\My Documents. Of course, the actual path will vary depending on the name of the logged-on user; in addition, ...

How Can I Copy and Rename a Worksheet in the Same Workbook?

Hey, Scripting Guy! I’d like to copy one of the worksheets in an Excel workbook and then paste that copy into the very same workbook; once it’s pasted it, I’d like to rename it. Can I do that?-- JG Hey, JG. Of course you can do this; after all, if you can do something in Excel it’s almost 100% guaranteed that you can do it using a ...

How Can I Clear a List Box in an HTA?

Hey, Scripting Guy! How can I clear a list box in an HTA?-- AK Hey, AK. For those of you who aren’t familiar with the term, an HTA - among other things - is a way to use Internet Explorer to provide a graphical user interface for your scripts. (If that still doesn’t answer your questions, don’t despair. Instead, stay tuned for April ...

How Can I Add a Word to a Text File if That Word Isn’t Already in the File?

Hey, Scripting Guy! How can I check a text file to see if a word appears in that file and, if it doesn’t, add the word to the file?-- JO Hey, JO. We seem to have gotten quite a few questions on this topic lately. You mentioned adding words to a custom dictionary for Microsoft Word; other people mentioned adding an entry to an LMHosts file...

How Can I Write Double Quotes to a Text File?

Hey, Scripting Guy! I’m using the FileSystemObject to create an XML file. However, I need to put double quote marks around some of the items in that file. How do I do that?-- JP Hey, JP. According to your email, you’re trying to write the following line to your XML file:<? xml version = "1.0" encoding = "UTF-8" ?> However, you’...