speedi Posted June 12, 2012 Posted June 12, 2012 I have tried and tried, but I can not get this runwait command line to work.. I always have difficulty with quoted command lines... PLEASE HELP! THANK YOU SO VERY MUCH! Jim $thedir = "c:\testdir" runwait("C:\WINDOWS\SYSTEM32\XCOPY.EXE" & chr(34) & @MyDocumentsDir & CHR(34) & ' ' & chr(34) & $thedir & chr(34) & ' /c/s/a/exclude:\exclude.txt >c:\backup.txt')
water Posted June 12, 2012 Posted June 12, 2012 How about this? runwait('C:\Windows\System32\XCOPY.EXE "' & @MyDocumentsDir & '" "' & $thedir & '" /c/s/a/exclude:exclude.txt >c:backup.txt') My UDFs and Tutorials: Reveal hidden contents UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
speedi Posted June 22, 2012 Author Posted June 22, 2012 Thanks for your help but that did not work.. I did this - highlight the whole line (the part inside the parentheses) in Scite and then hit ALT-D which will give you a consolewrite line containing the data and the variables, so you can see exactly how it is going to look in the command line. Then I execute the lines and look at the console write command in the output box.. the part after "=" I copied that part and pasted into a dos window to try it... It works in the dos window, but not in autoit script.. Here is the entire script with the line you gave me. Thanks for taking the time to look at this... $thedir = "c:testdir" runwait('C:\Windows\System32\XCOPY.EXE "' & @MyDocumentsDir & '" "' & $thedir & '" /c/s/a/exclude:exclude.txt >c:backup.txt') ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : ''C:\Windows\System32\XCOPY.EXE "'' & @MyDocumentsDir & ''" "'' & $thedir & ''" /c/s/a/exclude:exclude.txt >c:backup.txt'' = ' & 'C:\Windows\System32\XCOPY.EXE "' & @MyDocumentsDir & '" "' & $thedir & '" /c/s/a/exclude:exclude.txt >c:backup.txt' & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
water Posted June 22, 2012 Posted June 22, 2012 I think the Debug line is not very reliable in this situation. It adds another set of quotes. I copy the whole text to a ConsoleWrite statement: $thedir = "c:\testdir" ConsoleWrite('C:\WINDOWS\SYSTEM32\XCOPY.EXE "' & @MyDocumentsDir & '" "' & $thedir & '" /c/s/a/exclude:\exclude.txt >c:\backup.txt' & @CRLF) My result looks like this: C:\WINDOWS\SYSTEM32\XCOPY.EXE "C:\Users\xy\Documents" "c:\testdir" /c/s/a/exclude:\exclude.txt >c:\backup.txt My UDFs and Tutorials: Reveal hidden contents UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
speedi Posted June 22, 2012 Author Posted June 22, 2012 The debug line did produce the same result you had, but your method looks to be better... this is it.. C:\Windows\System32\XCOPY.EXE "C:Documents and SettingsJim MihalskiMy Documents" "c:testdir" /c/s/a/exclude:exclude.txt >c:backup.txt The problem is when that command is copied and pasted to a DOS window, the copy works just fine... BUT it does not work in the script.... nothing is copied. Can you try it in autoit? thanks
speedi Posted June 22, 2012 Author Posted June 22, 2012 just figured out why it was not working.. I should have been using: runwait(@ComSpec & " /c " & etc. etc. Now it works in the script... Thanks so much for your help....
water Posted June 22, 2012 Posted June 22, 2012 Glad you got the problem solved My UDFs and Tutorials: Reveal hidden contents UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
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