Windows IT Pro is the leading independent community for IT professionals deploying Microsoft Windows server and client applications and technologies.
  
  
  Advanced Search 


April 19, 2000

Understanding VBScript: The TextStream Object


RSS
View this exclusive article with VIP access -- click here to join |
See More VBScript Articles Here | Reprints | Or sign up for our VIP Monthly Pass!
SideBar    Why Not Binary Files?

This month, I continue my discussion of the File System Object (FSO) model by looking at the TextStream object. I show you how to access this object so that you can read and write to text files. However, before I discuss the TextStream object, I want to discuss why you might encounter a security warning if you run VBScript code that uses objects in the FSO model.

Security Implications When Using VBScript and FSO
Microsoft initially designed VBScript as a tool to make Web pages more interactive and responsive. As such, VBScript was subject to several security restrictions, including an inability to access the local file system. However, VBScript quickly evolved from a mere tool for writing Web pages to a general-purpose instrument for automating COM-based software.

Microsoft then introduced a modernized version of command.com for Windows OSs called Windows Script Host (WSH). Because VBScript is one of the languages that WSH supports, VBScript needed to gain access to local file-system elements so that VBScript code executing within the Windows shell could read and write to local files as well as access memory, databases, and other resources. . . .


Already a VIP member?
Please log on to view the full article

Why become a VIP member?

VIP-only online access
VIP CD delivered twice a year: offline access to the entire Windows IT Pro article library
Monthly issue of your choice of Windows IT Pro or SQL Server Magazine

Subscribe Now
Reader Comments
<P>It would be nice if you had commented on how to navigate through a text file, once it has been loaded into the memory buffer. Where can I find info on that?</P>

Ken Swenson October 26, 2003


<P>I need to write lines to the end of a file. When I use OpenTextFile for appending and issue writelines, I'm overwriting the lines, not appending. An example of this technique would be appreciated.</P>

harry March 01, 2004


I agree with Ken. I have been searching for "my November 1999 column for information about VBScript's string-manipulation functions", and cannot seem to find the correct article.

Joel April 14, 2004


<P>How do I implement the following code into a HTML Web page so that I can append information to a text file online?</P>
<BR>
&lt;HTML&gt; <BR>
&lt;BODY&gt; <BR>
&lt;SCRIPT&gt; <BR>
Set fso = CreateObject("Scripting.FileSystemObject") <BR>
Set ts = fso.CreateTextFile("foo.txt:MyExtraInfo") <BR>
ts.Write "This is my extra info" <BR>
ts.Close <BR>
<BR>
&lt;SCRIPT&gt; <BR>
&lt;BODY&gt; <BR>
&lt;HTML&gt; <BR>


john April 23, 2004


This is an excellent article for learning VBscript and grasping it's content. Thank you.

Anonymous User October 11, 2004 (Article Rating: )


You must be a registered user or online subscriber to comment on this article. Please log on before posting a comment. Are you a new visitor? Register now




Top Viewed ArticlesView all articles
Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...

WinInfo Short Takes: Week of November 9, 2009

An often irreverent look at some of the week's other news, including some more Windows 7 sales momentum, some Sophos stupidity, Microsoft's cloud computing self-loathing, more whining from the browser makers, Zoho's "Fake Office," and much, much more ...

Understanding File-Size Limits on NTFS and FAT

A general confusion about files sizes on FAT seems to stem from FAT32's file-size limit of 4GB and partition-size limit of 2TB. ...


Scripting Whitepapers From Development to Production: Streamlining SharePoint Deployment with DocAve Deployment Manager

Related Events Check out our list of Free Email Newsletters!

Scripting eBooks Keeping Your Business Safe from Attack: Encryption and Certificate Services

Best Practices for Managing Linux and UNIX Servers

Building an Effective Reporting System

Related Scripting Resources Introducing Left-Brain.com, the online IT bookstore
Looking for books, CDs, toolkits, eBooks? Prime your mind at Left-Brain.com

Discover Windows IT Pro eLearning Series!
Clear & detailed technical information and helpful how-to's, all in our trademark no-nonsense format


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro DevProConnections IT Job Hound
Left-Brain.com Technology Resource Directory asp.netPRO ITTV Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 © 2009 Penton Media, Inc. Terms of Use | Privacy Statement