On Your Own: Lab 12 Creating Files

In this lab, you will practice creating files. The result of this practice is essentially a code block that you can employ in other scripts to write information to a file instead of merely echoing it to the screen.

  1. Open Notepad.exe.

  2. Use Option Explicit and declare the following variables: logfile, objFSO, and objFile.

  3. Create an assignment for the variable logfile that will hold the name and path of your log file. The code will look like the following:

    LogFile = "C:\FSO\fso.txt"
  4. Open Windows Explorer and create a folder called FSO and a text file called Fso.txt on your C drive.

  5. Create a constant called ForWriting and set it equal to 2.

  6. Use CreateObject to create an instance of the FileSystemObject. Set it equal to a ...

Get Microsoft® Windows® Scripting Self-Paced Learning Guide 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.