Create VBScript to read in file values?

Author Message
durex

  • Total Posts : 21
  • Scores: 0
  • Reward points : 0
  • Joined: 3/8/2005
  • Location:
  • Status: offline
Create VBScript to read in file values? Tuesday, March 08, 2005 6:30 PM (permalink)
0
Been looking around and havent been able to find much about what Im hoping to do. I want to create a vbscript which will read in particular values from a 'config file'. This config file will have something similar to the following:

ProgName="prog.exe"
ProgPath="c:\temp"
ProgDesc="this is a prog"


and then repeated for multiple programs. is this something i can accomplish with vbscript?

Thanks!
 
#1
    token

    • Total Posts : 1917
    • Scores: 0
    • Reward points : 0
    • Joined: 1/14/2005
    • Location:
    • Status: offline
    Re: Create VBScript to read in file values? Tuesday, March 08, 2005 6:46 PM (permalink)
    0
    Sure, you can use VBS to accomplish that. The following script should get you started. Replace the file with the actual absolute path of the file you intend to read from.

    ================================================================================================
    Option Explicit

    Dim fso, temp, ts, file
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set ts = fso.OpenTextFile(file,1)
    file = "F:\test.txt"

    Do Until ts.AtEndOfStream
    temp = Split(ts.ReadLine,"=")
    WScript.Echo "Key : " & temp(0) & vbTab & vbTab & "Value: " & temp(1)
    Loop

     
    #2
      durex

      • Total Posts : 21
      • Scores: 0
      • Reward points : 0
      • Joined: 3/8/2005
      • Location:
      • Status: offline
      Re: Create VBScript to read in file values? Wednesday, March 09, 2005 3:45 AM (permalink)
      0
      Excellent... just what I was looking for.

      Thanks!
       
      #3
        token

        • Total Posts : 1917
        • Scores: 0
        • Reward points : 0
        • Joined: 1/14/2005
        • Location:
        • Status: offline
        Re: Create VBScript to read in file values? Wednesday, March 09, 2005 4:10 AM (permalink)
        0
        No problem :)

         
        #4

          Online Bookmarks Sharing: Share/Bookmark

          Jump to:

          Current active users

          There are 0 members and 1 guests.

          Icon Legend and Permission

          • New Messages
          • No New Messages
          • Hot Topic w/ New Messages
          • Hot Topic w/o New Messages
          • Locked w/ New Messages
          • Locked w/o New Messages
          • Read Message
          • Post New Thread
          • Reply to message
          • Post New Poll
          • Submit Vote
          • Post reward post
          • Delete my own posts
          • Delete my own threads
          • Rate post

          2000-2012 ASPPlayground.NET Forum Version 3.9