Sign in to follow this  
Followers 0
grunewald6

Xcopy broken in Windows 7? What am i doing wrong?

4 posts in this topic

I have an app I wrote that copies files or shortcuts to a txt file list of hostnames. It has worked fine from my laptop when it had xp, but now that I have Win7, I get an error during the copy operation and it never copies(narrowed it down by adding some debug code). I use xcopy so I can copy under admin credentials for our workgroup and domain machines. The copy code I use is below. Anyone else seen a similar problem in Win 7 or am I just blinded here? Thanks in advance for any help,

$send = 'xcopy "' & $FileSource & '" "\\' & $hostname & '\' & $Destination & '" /c /i /q /y'
$pid=RunAsWait($admin,  @ComputerName, $adminpw, 0, @ComSpec & " /c " & $send, "", @SW_HIDE)
    If ($pid = 0) Then
        MsgBox(16, "Error", "Error running copy command")
        Exit
    Endif

Share this post


Link to post
Share on other sites



I have an app I wrote that copies files or shortcuts to a txt file list of hostnames. It has worked fine from my laptop when it had xp, but now that I have Win7, I get an error during the copy operation and it never copies(narrowed it down by adding some debug code). I use xcopy so I can copy under admin credentials for our workgroup and domain machines. The copy code I use is below. Anyone else seen a similar problem in Win 7 or am I just blinded here? Thanks in advance for any help,

$send = 'xcopy "' & $FileSource & '" "\\' & $hostname & '\' & $Destination & '" /c /i /q /y'
$pid=RunAsWait($admin, @ComputerName, $adminpw, 0, @ComSpec & " /c " & $send, "", @SW_HIDE)
    If ($pid = 0) Then
        MsgBox(16, "Error", "Error running copy command")
        Exit
    Endif

The problem might be that the folder you are trying to copy to does not have full permissions. The permissions for a drive do not necessarily mean the folders have those permissions. The effect of this can be that using Windows Explorer to copy files might work and xcopy might not. I haven't got W7 so this is guesswork. Try using the command prompt and type the command by hand to see if there is some useful error message.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Good suggestion, Martin. I had thought along those same lines, too, but tried that before and xcopy from a cmd prompt worked fine. I thought it might me the RunAs command in AutoIT, but even if I log in as an admin on a local machine and try to copy files from those credentials with a RunWait, instead of a RunAsWait, it still errors out. No Win7 users out there?

Share this post


Link to post
Share on other sites

Have a look at the remarks of RunAsWait() in the helpfile. Note the sentence with working directory in it. See if any suggestions in there helps.

Share this post


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
Sign in to follow this  
Followers 0