WSC.File

Download

wsc-file.zip
Filesize: 2.5 KiB
Platform: Windows®

Requirements: Windows Script Host

WSC.File is Windows Scripting Component for intuitive I/O operations using FileSystemObject (FSO). FSO ships with Windows Script Host and serves as a basic file I/O class, but it's usage is non-intuitive and often confusing. WSC.File is a class that tries to simplify usage of FSO, by offering intuitive methods and parameters.

Installation

Register WSCWindows Scripting Component must be registered on the end user system, in order for windows script to be able to access it. Registration is easily achieved by right clicking the WSC file in Windows Explorer, and choosing "Register" from the context menu. Windows will then enter information about the component in the registry, and enable all windows scripts (whether they are written in JScript or VBScript) to create instances of it and use it's methods. Syntax is almost the same, so following JScript example can be easily rewritten in VBScript.

Usage

There is a <tryFile.js> file in ZIP distribution which demonstrates quickly the use of the class. Class is used in the following way:

var file = WScript.CreateObject('WSC.File');
 
file.open('hello_world.txt','read');
var str = '';
while (!file.eof)
	str += file.readLn() + '\n';
file.close();
 
WScript.Echo(str);

Class has following property:

Class has following methods:

If any errors are encountered, they will be logged at the end of file <errfile.err> in working directory.