Sunday, 27 April 2014

QTP - UFT - How to create a text file using VBScript


 
We can use "Scripting.FileSystemObject"

strfilepath = "C:\Sample.txt"
Set obj = Createobject("Scripting.FileSystemObject")
If obj.FileExists(strfilepath)  = false Then
 obj.CreateTextFile strfilepath,true
End If
Set obj = nothing


Note:- To run the script copy and paste the script in Notepad and save it with extension ".vbs". Example "CreateFolder.vbs". Double click the file to run the script.

Or

Copy and paste the script in UFT / QTP and press F5 ( i.e. Run Button)
 
Happy Reading,
Sreenu Babu




 




 















No comments:

Post a Comment