Chapter 8. Working with Files and Folders in VBScript and JScript

The file system is one of the most important parts of any operating system and Windows is no exception. Your scripts will often need to manage files and folders. For example, before you can extract information from a log file you must learn how to find files, how to check for a file's existence, and how to read files. This chapter examines high-level techniques for working with files and folders. You'll learn how to create files and folders, how to examine file and folder properties, and how to move and delete files and folders. Reading and writing files is the subject of Chapter 9.

Whenever you work with files or folders in protected locations, such as those used by the operating system, you'll want to ensure you use an elevated command prompt with administrator privileges, in order to have the appropriate permissions to work with files and folders. When you are working with files and folders on remote computers, keep in mind that the remote script is copied to the temporary directory of the account that accesses the remote computer and runs with the security settings for the remote computer and the temporary directory.

Note

Some of the scripts in this chapter are not fully working examples. The scripts may highlight only the syntax of how the commands could be used in a complete script. Also, you may need ...

Get Microsoft® PowerShell, VBScript and JScript® Bible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.