write a vb script to open a text file and write into it

Answers were Sorted based on User's Feedback



write a vb script to open a text file and write into it..

Answer / mudaseer

dim vfso
set vfso=createobject("scripting.filesystemobject")
set vf=vfso.opentextfile("C:\hello.txt",2)
vf.write("howruthere")


'here 2 is for write and 8 is for append

Is This Answer Correct ?    2 Yes 0 No

write a vb script to open a text file and write into it..

Answer / sojan davis- infosys

Const ForWriting = 2,
Dim fso, fileObj
Set fso = CreateObject("Scripting.FileSystemObject")
Set fileObj = fso.OpenTextFile(strConfigFile, ForWriting,
True)
fileObj.WriteLine("Hi")

fileObj.Close
Set fileObj=Nothing
Set fso=Nothing

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More VB Script Interview Questions

What is the difference between for loop and while loop?

0 Answers  


explain with example primitive data types of vb script.

1 Answers  


Hi Friends Rajendra this is bhavani prasad, iam working Hyderabad. i faced one problem with qtp recording mode i.e in my application there is 100 records first we click the first record that record will be jumped to next session and 99 records will there stop the recording and run the same script .Run this script qtp does not identify the records. So plz tell me what is the solution.

0 Answers  


A folder is there inside no of textfiles are avilable. How do count the textfiles. Normally folder means we are using subfolder methods but textfiles is not working for subfolder methods and how do get file name also.

0 Answers  


Mention what is the use of option explicit in vbscript?

0 Answers  


What is the purpose of the err object in the vbscript language?

0 Answers  


For a webbased application:- what should be code in expert veiw, for retrieving a single column name "username" from a server and checking whether exported "username" from datatable doesn't exist in server. suppose i have saved in excelsheet a username="gayatri" , which is exported, then checked for whether this username "gayatri" exist in server database or not ? if exist then allow to enter new username, which should be again checked for in loop , or else come out of loop and enter a distinct "username". plz let me have this answer in my id gayatrisahooin@hotmail.com

0 Answers  


Join the multiple array with out using JOIN function

1 Answers  


Give examples where vb script can directly run on users system with windows as os?

1 Answers  


Hi I don't have any idea on VBscript. can any one point me to a good web site to learn VBscript. Regards lina

2 Answers  


sunday is sunday monday tuesday wendesday sunday thursday friday saturday sunday sunday how to count no of sunday in the text file from vb? Answer me asap

4 Answers  


Explain about constants in vb script?

0 Answers  


Categories