Access Denied when trying to write a file in UFT and Win 10
Question ID: 108544
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: 227, Answers: 22)
Asked on July 27, 2018 2:00 am
423 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: 2, Answers: 477)
Answered on July 27, 2018 2:02 am
EyeOnTesting

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

X
Scroll to Top