ajblandford Posted February 21, 2010 Share Posted February 21, 2010 Let me start by saying I love Autoit. It's so easy to work with usually. I'm not a programmer. When I was in high school, advanced computer programming taught Basic. I've started working with Autoit recently and so far have made a couple of cool programs. I work in computer repair, and business is great. We have several Newbies, I need to write a simple script to use robocopy to copy files from one location to another with predetermined swithces. Robocopy can run as a backup process and copy files even if the newbies forget to take permission of the folder to be copied. I have my GUI that returns selected locations, but when I try to use my variables with comspec I always get an error in command prompt "the system cannot find the path specified. I'm sure it's a simple syntax error, but I need a little help. RunWait(@ComSpec & " /k " & '"robocopy.exe" & $src & $dest "\*.* /FP /S /E /COPY:DAT /ZB /R:0 /W:0"',"",@SW_SHOW) Any assistance would be greatly appreciated. Thanks in advance. Link to comment Share on other sites More sharing options...
MHz Posted February 21, 2010 Share Posted February 21, 2010 Welcome to the forum ajblandford, Try showing your CMD string in a messagebox to see if it looks correct if you have issues. Take note in the help file under Run() / RunWait() for the remark with paths with spaces need to be enclosed in quotation marks. ; Try showing the CMD string in a messagebox to see result $src = 'c:\path\with\white space' $dest = 'c:\path\with some more\white space' $cmd = '"' & @ComSpec & '" /k robocopy.exe "' & $src & '" "' & $dest & '\*.*" /FP /S /E /COPY:DAT /ZB /R:0 /W:0' MsgBox(0, 'CMD string to use', $cmd) ; Solution to try ;~ RunWait('"' & @ComSpec & '" /k robocopy.exe "' & $src & '" "' & $dest & '\*.*" /FP /S /E /COPY:DAT /ZB /R:0 /W:0', "", @SW_SHOW) The messagebox above shows my attempt at the command needed. Hopefully is OK. The RunWait() line is commented for safety. Uncomment for testing. I would test on some *copies* of folders first. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now