Jump to content

Help with xcopy


 Share

Recommended Posts

Hi guys

I'm a little stuck here, and could use some help.

All I want to do is copy all content from FolderA to FolderB, but I can only make it work if I define the entire path.

 

This works:

#include <Process.au3>

_RunDOS("xcopy C:\Users\USERNAME\AppData\Roaming\Microsoft\FolderA C:\Users\USERNAME\AppData\Roaming\Microsoft\FolderB /E /I")

 

But this doesn't:
 

#include <Process.au3> ;Makes sure that you can use _RunDos statements

$FolderA = @AppDataDir & "\Microsoft\FolderA\"
$FolderB = @AppDataDir & "\Microsoft\FolderB\"


_RunDOS("xcopy $FolderA $FolderB /E /I")

 

Any ideas? :)

 

David

Edited by david1337
Link to comment
Share on other sites

This is the way to do it.

#include <Process.au3> ;Makes sure that you can use _RunDos statements

$FolderA = @AppDataDir & "\Microsoft\FolderA\"
$FolderB = @AppDataDir & "\Microsoft\FolderB\"


_RunDOS("xcopy " & $FolderA & " " & $FolderB & " /E /I")

 

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Link to comment
Share on other sites

in the 'working example'  they dont have a trailing backslash.  try it with run("cmd /k xcopy " .....)  and see if we can get an output?

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

Remove the trailing backslashes from the 2 paths like you had in your first attempt.

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Link to comment
Share on other sites

boththose,

thanks! Removing the trailing backslashes worked :)

@ Bowmore: Your example worked perfect when I removed the backslashes.

Thanks to both of you!

#include <Process.au3> ;Makes sure that you can use _RunDos statements

$FolderA = @AppDataDir & "\Microsoft\FolderA"
$FolderB = @AppDataDir & "\Microsoft\FolderB"


_RunDOS("xcopy " & $FolderA & " " & $FolderB & " /E /I")

 

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...