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.
Open Notepad.exe.
Use Option Explicit and declare the following variables: logfile, objFSO, and objFile.
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"
Open Windows Explorer and create a folder called FSO and a text file called Fso.txt on your C drive.
Create a constant called ForWriting and set it equal to 2.
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.