Sign in to follow this  
Followers 0
Elahrairah

"Run" Command / Variable / Arguments

5 posts in this topic

This is very strange. The following code works just fine:

$run = """c:\documents and settings\Administrator\desktop\testprogram.exe"""
$result = run($run)
msgbox(0, "Result", $result)

However, the following code fails and returns a "0".

$run = """c:\documents and settings\Administrator\desktop\testprogram.exe -a"""
$result = run($run)
msgbox(0, "Result", $result)

The above code assigns a value to $run directly. However, in the actual application I am working on, $run = $cmdline[1]. That is why I am using a variable ($run) in the Run() command.

It wouldn't surprise me if I'm simply screwing this up. I was wondering if anyone had seen this behavior before? Any assistance would be greatly appreciated.

This is compiled using AutoIt 3.3.0.0.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I don't include double quotes on the parameter I give Run.

$run = """c:\documents and settings\Administrator\desktop\testprogram.exe -a"""
$result = run($run)
msgbox(0, "Result", $result)
Edited by omikron48

Share this post


Link to post
Share on other sites

This is very strange. The following code works just fine:

$run = """c:\documents and settings\Administrator\desktop\testprogram.exe"""
$result = run($run)
msgbox(0, "Result", $result)

However, the following code fails and returns a "0".

$run = """c:\documents and settings\Administrator\desktop\testprogram.exe -a"""
$result = run($run)
msgbox(0, "Result", $result)

The above code assigns a value to $run directly. However, in the actual application I am working on, $run = $cmdline[1]. That is why I am using a variable ($run) in the Run() command.

It wouldn't surprise me if I'm simply screwing this up. I was wondering if anyone had seen this behavior before? Any assistance would be greatly appreciated.

This is compiled using AutoIt 3.3.0.0.

That wouldn't work on the console command line or Start/Run dialog box either. Your double quotes should only be around the executable's path, because it contains spaces. You make it appear to the shell that " -a" is part of the executable path vice a parameter. Try it like this:
$run = """c:\documents and settings\Administrator\desktop\testprogram.exe"" -a"
$result = run($run)
msgbox(0, "Result", $result)

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Yup--I was screwing it up. Thanks for the assist, that works beautifully.

Share this post


Link to post
Share on other sites

This should also work

$run = '"c:\documents and settings\Administrator\desktop\testprogram.exe" -a'
$result = run($run)
msgbox(0, "Result", $result)

:)

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