Sign in to follow this  
Followers 0
Necromorph

@ComSpec xcopy, can u use $var for $dir?

7 posts in this topic

i can't get this to work, and im wondering if you can push a $var into the command for the directory:

#archivesLocalDir = @MyDocumentsDir & "\Folder\Folder\"
#archivesNetworkDir = @HomeShare & "\Folder\Folder\"

If @HomeDrive <> "U:" or DriveStatus("U:") <> "Ready" Then
     Exit
Else
     $val = RunWait(@ComSpec & " /c" & "xcopy " & '"' & $acrivesLocalDir & '" "' & $archivesNetworkDir & '" /c /d /e /y')
     MsgBox(0, "Return Code", $val)
EndIf

but this isn't doing anything, and it is returning either "1" or "4" as i mess with it, there meanins can be found here http://technet.microsoft.com/en-us/library/bb491035.aspx. im just wondering if it is because of the the variables. thanks for any help.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

It seems to be that you have forgotten the blank after /c!

$acrivesLocalDir = @MyDocumentsDir & "\Folder\Folder"
$archivesNetworkDir = @HomeShare & "\Folder\Folder"

If @HomeDrive <> "U:" or DriveStatus("U:") <> "Ready" Then
    Exit
Else
    $val = Run(@ComSpec & " /c " & "xcopy " & '"' & $acrivesLocalDir & '" "' & $archivesNetworkDir & '" /c /d /e /y')
    MsgBox(0, "Return Code", $val)
EndIf

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

The Help Doc says to put the " " before the "/c", and if i format it to this " /c " it returns "0" which means all files were copied without error, but, nothing actually coppied, im not sure what is going on.

Share this post


Link to post
Share on other sites

Try RUN instead of RunWait!

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

Still no good, im frustrated, thanks for the help.

Share this post


Link to post
Share on other sites

Hmm, try to remove the last "\" from the source and destination folder!

I've update the code from post #2!

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

haha, i tried that too. this is so dumb, i have some batch scirpts that do xcopy, and they all have the "\" at the end of the $dir. this is so dumb, and as for the senero: $archiveLocalDir has two files in it Test1.txt and Test2.txt, and $archiveNetworkDir, has nothing, i am a domain admin as well as a local admin, and just trying to xcopy to my personal drive on a file server, i have permissions to do so, so i don't think it's an NTFS issue. ggggggggrrrrrrrrr. im out of ideas. haha.

i spoke to soon, removing the "\" at the end fixed it, why not sure, but i had tried that, but not before i move the " /c" to " /c ". thanks for the help!!

Edited by redLabel

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