Jump to content

Variable inside run command.


Recommended Posts

Hi everyone,

I am trying to pass a variable into the run command but it fails everytime. I have found other scripts in the forum that have the same feature but also fail. Was there a change made in the new AutoIT that no longer permits this? Here is an example.

$Blue = "C:\Windows\Programs\testing.exe"

Run($Blue)

When I execute the script I get an error saying:

Unable to find Run($Blue)

Is there something I am missing?

Thanks

Link to comment
Share on other sites

...Here is an example...

Since your example is mentioned in a large scope concerning Run(), then perhaps some attempts are with paths with whitespace. Use double quotes with function call. Installed programs may require a working directory to be passed also.

$file = 'testing.exe'
$path = 'C:\Windows\Programs'

If FileExists($path & '\' & $file) Then
    MsgBox(0x40000, 'Command to Run ', _
            '"' & $path & '\' & $file & '"' & _
            ' with the working directory of ' & $path)
    Run('"' & $path & '\' & $file & '"', $path)
Else
    MsgBox(0x40000, Default, $path & '\' & $file & ' not found')
EndIf

:)

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