Jump to content

"Run" Command / Variable / Arguments


Recommended Posts

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.

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