Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Web Development
Expertise: Beginner
Jan 20, 1999



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Using the Scripting.FileSystemObject on the Client

I am trying to write a script that creates a small file on the client machine. The script is trying to use the FileSystemObject. I have tried MSDN Library sample code for this, but I always receive a Type Mismatch when trying to create the object. The MSDN sample code is:
Dim fs
Dim a

Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile("c:\testfile.txt", True)
a.WriteLine("This is a test.")
According to documentation, the FileSystemObject should be supported by Internet Explorer version 3.0 and later. Internet Explorer 3.01 is our current company standard, so going to version 4.0 is not an option. What do I need to do to get IE 3.01 to successfully create the object?

The Scripting.FileSystemObject is not installed with any version of Internet Explorer and is not tied to it in any way. VBScript does not have built-in functionality for manipulating files or folders. The Scripting.FileSystemObject was created to enable server-side script to do that. It is installed with Active Server Pages on the server, and not with IE on the client.

In order to use client-side scripting to manipulate files and folders on the client machine, you will need some sort of compiled component. VBScript cannot do it alone. To check whether your client machine has the Scripting.FileSystemObject installed, select Start|Run from your client machine (not the server). Type regedit in the box that appears and click OK. When the Registry Editor appears, select Edit|Find and type Scripting.FileSystemObject in the box that appears and click Find Next.

It is likely that you will not find the Scripting.FileSystemObject in the registry of your client machine (provided your client and server are not the same machine), which explains why your code has failed.

Try the same code in server-side script.

As I mentioned before, in order to accomplish what you want to do, you'll need to build a component (DLL, EXE, Control, etc.) that runs on the client, then call that component from your client-side script.

DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date