Before reading special characters in a text file, vbs reads the value of a comma and assigns it to a variable.

Source: Internet
Author: User
The simulation terminal securecrt I use requires a script that supports vbs. I need to implement the following functions:

First, the text file is in: D: \ 100.txt
The text file content is:
9 0, Randy,
9 1, Jeff,
9 2, sameul,

Now we need a loop to automatically execute related parameters. The loop needs to call two variables TN and name.
Assign the value before the first comma to TN and the parameter before the second comma to name. I have never learned vbs. Please try to write details as much as possible.


Set FSO = wscript. Createobject ("scripting. FileSystemObject ")
Set Fr = FSO. opentextfile ("D: \ 100.txt", 1)

Do until Fr. atendofstream
A = Fr. Readline: B = Split (a, ","): J = J + 1
Tn = B (0): name = B (1)
Msgbox "& J &" line "& vbcrlf &" tn: "& TN &"; Name: "& name
Loop

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.