Jump to content

DirCopy() is not working with #RequireAdmin


Recommended Posts

Hello,

I'm copying a folder from a network drive to an USB memory key, using this script:

Local $sPathFrom = "G:\temp\test files from\"
Local $sPathTo = "D:\temp\test files to\"
Local $sRet

$sRet = DirCopy($sPathFrom, $sPathTo)
If (Not $sRet) Then
    MsgBox($MB_OK, "Copy test", "Unable to copy the folder! - $sRet: " & $sRet)
Else
    MsgBox($MB_OK, "Copy test", "Copy OK! - $sRet: " & $sRet)
EndIf

Before testing, I deleted the destination folder just to be sure that there is no folder at the destination path.

It works pretty well and returns 1, but, if I add the directive #RequireAdmin it doesn't work and returns 0. Is there some not documented details about DirCopy() function? Or am I missing something?

Thanks in advance

Link to post
Share on other sites

I guess your Admin-Account doesn't have "G:" mapped or does not have permissions to

G:\temp\test files from\

 

Edited by ajag
further guess

Rule #1: Always do a backup         Rule #2: Always do a backup (backup of rule #1)

Link to post
Share on other sites
  • 2 weeks later...

open an administrative CMD.EXE  box ("Run as Administrator")

Then type

net use

and, as already mentioned by Jos

dir \\server\share\path\file.xyz

... to see, if you have access rights in the "Admin UAC context"

 

If not, then use ...

net use \\server\ipc$ /user:domain\user *

... to see, if you are able to gain access rights now.

 

Autoit: See the Help File for DriveMap* functions.

 

CU, Rudi.

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...