Showing posts with label Create a file using VBScript. Show all posts
Showing posts with label Create a file using VBScript. Show all posts

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