Using the Scripting.FileSystemObject on the Client

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 fsDim aSet fs = CreateObject("Scripting.FileSystemObject")Set a = fs.CreateTextFile("c:	estfile.txt", True)a.WriteLine("This is a test.")a.Close

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.

See also  5 Strategies for Supercharging Your CRM

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.


About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist