Sign in to follow this  
Followers 0
speedi

ran out of ideas - need help??

7 posts in this topic

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')

Share this post


Link to post
Share on other sites



How about this?

runwait('C:\Windows\System32\XCOPY.EXE "' & @MyDocumentsDir & '" "' & $thedir & '" /c/s/a/exclude:exclude.txt >c:backup.txt')

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Glad you got the problem solved ;)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


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
Sign in to follow this  
Followers 0