Jump to content

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


Recommended Posts

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.

Link to comment
Share on other sites

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...