Using the Scripting.FileSystemObject on the Client

Question:
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?

Answer:
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.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

The Latest

homes in the real estate industry

Exploring the Latest Tech Trends Impacting the Real Estate Industry

The real estate industry is changing thanks to the newest technological advancements. These new developments — from blockchain and AI to virtual reality and 3D printing — are poised to change how we buy and sell homes. Real estate brokers, buyers, sellers, wholesale real estate professionals, fix and flippers, and beyond may

man on floor with data

DevX Quick Guide to Data Ingestion

One of the biggest trends of the 21st century is the massive surge in internet usage. With major innovations such as smart technology, social media, and online shopping sites, the internet has become an essential part of everyday life for a large portion of the population. Due to this internet

payment via phone

7 Ways Technology Has Changed Traditional Payments

In today’s digital world, technology has changed how we make payments. From contactless cards to mobile wallets, it’s now easier to pay for goods and services without carrying cash or using a checkbook. This article will look at seven of the most significant ways technology has transformed traditional payment methods.