Jump to content

Recommended Posts

Hi there,

I'm pretty new to all this, so please don't hit me if this question is too simple :D

I want to run xcopy via autoit and the variable has to be a part of the path from which to copy the files from...

RunWait("xcopy C:\test\all\all " & $Variable1 & $Variable2 & "/e /y /r")

RunWait("xcopy 'C:\test\' & $Variable3 & '\' & $Variable4 & " & $Variable1 & $Variable2 & "/e /y /r")

The first code is working so I don't think that anything is amiss with the variables... but I'm a bit clueless how to put the variables into the path of the source... :D

Variable 1 is something like C:\test2\

Variable 2 is something like ZZZZZ

Variable 3 is something like 01

Variable 4 is something like 1

for example: xcopy C:\test\01\1 C:\test2\ZZZZZ /e /y /r

Hope you get me... and can help me :o

Link to post
Share on other sites
  • Developers

First example is missing a space before /e

RunWait("xcopy C:\test\all\all " & $Variable1 & $Variable2 & " /e /y /r")

Seconds one something like:

RunWait('xcopy "C:\test\' & $Variable3 & '\' & $Variable4 & '" "' & $Variable1 & $Variable2 & '"/e /y /r')

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to post
Share on other sites

Hey...

I got the same kind of problem again... is there any tutorial on how to " and ' those variables?! I didn't find anything useful :D

So again I want to do some xcopy on paths which are variable... this time a bit diffrent:

RunWait('xcopy "C:\test\' & $file & '.exe' & '" "' & $Pfad & $pfadu & '" "' & '/e /y /r"')

$pfad is something like "C:\test2\" and $pfadu is something like "test\test\"

I would be very grateful if someone could help me on this :/

Link to post
Share on other sites
  • Moderators

Hey...

I got the same kind of problem again... is there any tutorial on how to " and ' those variables?! I didn't find anything useful :D

So again I want to do some xcopy on paths which are variable... this time a bit diffrent:

RunWait('xcopy "C:\test\' & $file & '.exe' & '" "' & $Pfad & $pfadu & '" "' & '/e /y /r"')

$pfad is something like "C:\test2\" and $pfadu is something like "test\test\"

I would be very grateful if someone could help me on this :/

You could use double-double quotes if it makes it easier. No idea what the vars are, so you may need a space between the two $P+ vars:
RunWait("xcopy """ & @HomeDrive & "\test\" & $file & ".exe"" " & $Pfad & $pfadu & " /e /y /r")

Easiest way to see if you've done it correctly is to view it first:

MsgBox(64, "View Quotes", "xcopy """ & @HomeDrive & "\test\" & $file & ".exe"" " & $Pfad & $pfadu & " /e /y /r")
After practicing with singlequotes/double/and double-single/double quotes, you'll become a quote Jedi

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to post
Share on other sites

Hey Smoke,

thanks for another fast answer :D

... but that didn't work for me. I tried some more with a collegue and the following line worked for me:

RunWait('xcopy "C:\test' & $file & '.exe"' & ' "' & $Pfad & $pfadu & '" ' & '/e /y /r')

But I think the msgbox tip might come in handy :o

Thank you for this!

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