UFT write to file
Question ID: 108330
0
0

There is a write to file feature built in and I want it to take some output results and create a new text file with them. The problem I'm having is that I get Access Denied when it tries to create the file. I'm not finding anywhere to set any permissions.

Marked as spam
Posted by (Questions: 89, Answers: 4)
Asked on April 27, 2018 11:39 pm
334 views
Answers (1)
0
Private answer

It is most likely caused by Windows itself. Windows (especially Windows 10) will prevent VBScript from writing to most parts of the file system. It does allow VBScript to write to the Desktop or any other folder under Users. This isn't an issue with UFT, but with Windows and how it handles VBScript permissions. You can try this for yourself by the following test script. Just change the part to one of the Windows user ids on your machine. You can navigate to the C:Users path to get that if you need. The sample code should run and create a small test file on the user's desktop. You can also change the Desktop to be something like Downloads, Documents, etc. as long as it is a folder under the user.

Set FSO=CreateObject(''Scripting.FileSystemObject'')
Set FS=FSO.CreateTextFile(''C:UsersDesktopTest.txt'', True)
FS.WriteLine ''This is a test''
FS.Close
Set FS=Nothing
Set FSO=Nothing

Marked as spam
Posted by (Questions: 227, Answers: 22)
Answered on April 27, 2018 11:40 pm
EyeOnTesting

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

X
Scroll to Top