Jump to content

Issue with /AutoIt3ExecuteLine and @ComSpec


Recommended Posts

Hi all,

I've been trying to get this going for hours now with no luck. I'm sure it's a case of a badly-placed ' or " but damned if I can figure out where. Below is the relevant code (I know I could run this all from one line, but the code is split out into multiple functions for a bunch of reasons and it works fine in plenty of other places.):

$Command="robocopy \\Server\Share$\ /S /PURGE /R:0 C:\Destination /XF *.au3"

$CMDToRun="RunWait(@ComSpec&' /k "&$Command&"','C:\Windows', @SW_SHOW)"

Run(@AutoItExe&" /AutoIt3ExecuteLine "&$CMDToRun)

If I console.write $CMDToRun and then paste it into a test.au3, it works fine. If I run it using /AutoIt3ExecuteLine, I get:

Line 1:

RunWait(@ComSpec&'

RunWait(@ComSpec&'^ ERROR

Error: String missing closing quote.

But I've tried every way I could think of to get the quotes right without any luck.

Any help appreciated!

Link to comment
Share on other sites

I may have a working version to use. The echo seems to work fine.

;~ $Command = "robocopy \\Server\Share$\ /S /PURGE /R:0 C:\Destination /XF *.au3"
$Command = 'echo testing...'
$CMDToRun = "RunWait(@ComSpec&' /k " & $Command & "',@WindowsDir,@SW_SHOW)"
Run('"' & @AutoItExe & '" /AutoIt3ExecuteLine "' & $CMDToRun & '"')

:)

Link to comment
Share on other sites

I may have a working version to use. The echo seems to work fine.

;~ $Command = "robocopy \\Server\Share$\ /S /PURGE /R:0 C:\Destination /XF *.au3"
$Command = 'echo testing...'
$CMDToRun = "RunWait(@ComSpec&' /k " & $Command & "',@WindowsDir,@SW_SHOW)"
Run('"' & @AutoItExe & '" /AutoIt3ExecuteLine "' & $CMDToRun & '"')

:)

Ah geez it was the Run /AutoIt3ExecuteLine line causing the problem, not the line I was sending to run.

Thanks a lot MHz, really appreciate the help.

cheers,

Spud

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...