Forum Discussion

priyaram's avatar
priyaram
Occasional Contributor
8 years ago
Solved

'An error occurred while copying a specified file (folder)' error occurred when using aqFileSystem

We are getting ‘An error occurred while copying a file (folder)’ when trying to copy specified folder using aqFileSystem.CopyFolder(sourcelocation, targetlocation). When opening specified target loca...
  • Colin_McCrae's avatar
    Colin_McCrae
    8 years ago

    smartpriya wrote:

     

    After launching TC with admin rights the specified folder has been copied to the target location without UAC permission.


    I think you have your answer then. You want to run TC as Admin.

     

    The program (TC in this case) is what has the UAC applied to it at runtime. The link to the TC support page I posted further up gives all the details around that. You can't alter UAC for a single command within the running program. (Again, the link further up explains this - plus, it's how UAC works.)

     

    So if you want to be able to copy files in a UAC protected area, without having to run TC as admin, you'll be in the boat I described above where you'll need to invoke a command line window, with elevated rights, and use that to do your file moves. You can validate the moves with TC once the command line stuff has done it's thing, but you're not going to be able to do it all from within TC itself without running it as admin.

     

    http://stackoverflow.com/questions/32799960/jscript-how-to-get-elevated-privileges-admin-rights

  • tristaanogre's avatar
    tristaanogre
    8 years ago

    The only other alternative is, outside of TestComplete, to apply the rights to the folder to allow users read/write access so that UAC is not invoked.  As Colin_McCrae said, this is how UAC works.