Lab 13 Creating a Log File

In this lab, you are going to modify the script created in Lab 12 to check for the existence of the log file. If the file exists, you will overwrite it. If it does not exist, you will create it.

  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. Use 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. Create a constant called ForAppending and set it equal to 8.

  7. Use CreateObject to create an instance of FileSystemObject ...

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.