josephlo Posted April 6, 2012 Posted April 6, 2012 Hi,I am new to this forum and would appreciate some help to one of the script I am writing.I wanted to code a rsync script to run automatically. The rsync command line script (when executed at windows console window) isc:\program files\deltacopy\rsync.exe -v -rlt -z -avr --chmod=a+rwx,g+rwx,o+rwx /cygdrive/D/#PERSONAL FILE STORAGE/ 192.168.1.3::disk1_Archive1/Vostro//#PERSONAL FILE STORAGE/and this command works well in a console window.My autoit script looks like this.ShellExecute("c:\program files\deltacopy\rsync.exe", "-v -rlt -z -avr --chmod=a+rwx,g+rwx,o+rwx /cygdrive/D/#PERSONAL FILE STORAGE/ 192.168.1.3::disk1_Archive1/Vostro//#PERSONAL FILE")But the script is not running. Appreciate if anyone could give me some insights.Thanks
JohnOne Posted April 6, 2012 Posted April 6, 2012 (edited) Try using Run() function instead of ShellExecute()There may be an issue with spaces, but try it first.EDIT:ie $sRun = "c:program filesdeltacopyrsync.exe -v -rlt -z -avr --chmod=a+rwx,g+rwx,o+rwx /cygdrive/D/#PERSONAL FILE STORAGE/ 192.168.1.3::disk1_Archive1/Vostro//#PERSONAL FILE STORAGE/"Run($sRun) Edited April 6, 2012 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
josephlo Posted April 6, 2012 Author Posted April 6, 2012 Thanks John for your reply. There is no error message when compiling/running but the script is still not executing....if it does i will be able to see the server be rsynced with the files from the source folder. Any ideas? Thanks again
Developers Jos Posted April 7, 2012 Developers Posted April 7, 2012 try this version and see if there are any errors: Run(@ComSpec & " /k c:program filesdeltacopyrsync.exe -v -rlt -z -avr --chmod=a+rwx,g+rwx,o+rwx /cygdrive/D/#PERSONAL FILE STORAGE/ 192.168.1.3::disk1_Archive1/Vostro//#PERSONAL FILE") Just replace the /K with /C when it works to have the window closed automatically and look at the other options when you want the window not to appear at all. 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.
josephlo Posted April 7, 2012 Author Posted April 7, 2012 (edited) Hi Jos, Thanks for that. If I use Run(@ComSpec & " /K c:program filesdeltacopyrsync.exe -v -rlt -z -avr --chmod=a+rwx,g+rwx,o+rwx /cygdrive/D/#PERSONAL FILE STORAGE/ 192.168.1.3::disk1_Archive1/Vostro//#PERSONAL FILE STORAGE/") The cmd.exe console window will be launched (but it is not doing anything else) and the script will not run. If I use Run(@ComSpec & " /C c:program filesdeltacopyrsync.exe -v -rlt -z -avr --chmod=a+rwx,g+rwx,o+rwx /cygdrive/D/#PERSONAL FILE STORAGE/ 192.168.1.3::disk1_Archive1/Vostro//#PERSONAL FILE STORAGE/") A console window will open and close immediately (in a flick of an eye) and the script is also not executing. Any other thoughts? Thanks again Edited April 7, 2012 by josephlo
Developers Jos Posted April 7, 2012 Developers Posted April 7, 2012 (edited) What happens when you use the /K as suggested? (Guess the first command was supposed to show /K... right?) Any errors/messages shown in the CMD window when you use it with /K? Edited April 7, 2012 by 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.
josephlo Posted April 7, 2012 Author Posted April 7, 2012 (edited) Sorry. I make a typo in my reply. The first code is with the /K command. I have amended my post above. The CMD window but there are no error messages whatsoever. The CMD window just open and sit there....not doing anything... Edited April 7, 2012 by josephlo
DeltaRocked Posted April 7, 2012 Posted April 7, 2012 (edited) Hi josephlo, the issue is with long filenames with spaces in this case 'program files' Run(@ComSpec & " /C 'c:program filesdeltacopyrsync.exe' -v -rlt -z -avr --chmod=a+rwx,g+rwx,o+rwx '/cygdrive/D/#PERSONAL FILE STORAGE/' '192.168.1.3::disk1_Archive1/Vostro//#PERSONAL FILE STORAGE/'",'c:program filesdeltacopy') Regards Deltarocked Edited April 7, 2012 by deltarocked
Developers Jos Posted April 7, 2012 Developers Posted April 7, 2012 Couple of questions:Does the command "as-is" work when typed into an CMD window manually?Any specific Workdir required for the command to work? One thing I would have assumed is that you need to Double quote the paths shown in the commandline like: Run(@ComSpec & ' /k c:program filesdeltacopyrsync.exe -v -rlt -z -avr --chmod=a+rwx,g+rwx,o+rwx "/cygdrive/D/#PERSONAL FILE STORAGE/" "192.168.1.3::disk1_Archive1/Vostro//#PERSONAL FILE STORAGE/"') 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.
josephlo Posted April 7, 2012 Author Posted April 7, 2012 Yep. The command that I mentioned works well. This is what I currently have in a CMD script. I copied and pasted exactly from the cmd file. "c:Program FilesDeltacopyrsync.exe" -v -rlt -z --delete -avr --chmod=a+rwx,g+rwx,o+rwx "/cygdrive/D/#PERSONAL FILE STORAGE/" "192.168.1.3::disk1_Archive1/08_Joseph_and_Norah//#PERSONAL FILE STORAGE/" This works well but for whatever reason, it is not working with AutoIT.
Developers Jos Posted April 7, 2012 Developers Posted April 7, 2012 This should be the AutoIt3 version of your last posted line: Run(@ComSpec & ' /k "c:Program FilesDeltacopyrsync.exe" -v -rlt -z --delete -avr --chmod=a+rwx,g+rwx,o+rwx "/cygdrive/D/#PERSONAL FILE STORAGE/" "192.168.1.3::disk1_Archive1/08_Joseph_and_Norah//#PERSONAL FILE STORAGE/"') 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.
josephlo Posted April 7, 2012 Author Posted April 7, 2012 Ok. I tried that and a cmd window pops up and it says 'C:Program' is not recognized as an internal or external command, operable program or batch file.
Developers Jos Posted April 7, 2012 Developers Posted April 7, 2012 ok ....try this version: Run(@ComSpec & ' /k ""c:Program FilesDeltacopyrsync.exe" -v -rlt -z --delete -avr --chmod=a+rwx,g+rwx,o+rwx "/cygdrive/D/#PERSONAL FILE STORAGE/" "192.168.1.3::disk1_Archive1/08_Joseph_and_Norah//#PERSONAL FILE STORAGE/""') 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.
josephlo Posted April 7, 2012 Author Posted April 7, 2012 Jos, u are brillant! That works like a charm!!! I can see that the ' and " are pretty confusing in this kind of script. Thanks again!!! U rock!
Developers Jos Posted April 7, 2012 Developers Posted April 7, 2012 I know there is something goofy going on every now and then with Commandline lexing but know that surrounding the whole command with an extra set of doublequotes often solves it. Enjoy, 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.
MisterVSE Posted August 30, 2016 Posted August 30, 2016 "c:\program files\deltacopy\rsync.exe", Why did the inverted slash disappeared from your last posts? The message "Program is not recognized" is the result of the lack of "\" after the c: , and this makes CMD processor search for a program called "program" that is the first free word in the string.
Moderators Melba23 Posted August 30, 2016 Moderators Posted August 30, 2016 (edited) MisterVSE, Quote Why did the inverted slash disappeared from your last posts? One of the forum updates did that to every piece of previously posted code - and very happy we all were, NOT! M23 Edit: Welcome to the AutoIt forums. Edited August 30, 2016 by Melba23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
JohnOne Posted August 30, 2016 Posted August 30, 2016 4 year bump for this, lol. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
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