Sign in to follow this  
Followers 0
SpuddyMcSpud

Issue with /AutoIt3ExecuteLine and @ComSpec

6 posts in this topic

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!

Share this post


Link to post
Share on other sites



Thanks for replying Volly.

Still no luck - same error as before.

Share this post


Link to post
Share on other sites

I'm still completely stumped by this one, been trying to work it out all day - anyone able to shed any light at all??

Share this post


Link to post
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 & '"')

:)

Share this post


Link to post
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

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