Elahrairah Posted October 15, 2009 Share Posted October 15, 2009 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 More sharing options...
omikron48 Posted October 15, 2009 Share Posted October 15, 2009 (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 October 15, 2009 by omikron48 Link to comment Share on other sites More sharing options...
PsaltyDS Posted October 16, 2009 Share Posted October 16, 2009 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 More sharing options...
Elahrairah Posted October 16, 2009 Author Share Posted October 16, 2009 Yup--I was screwing it up. Thanks for the assist, that works beautifully. Link to comment Share on other sites More sharing options...
TurionAltec Posted October 16, 2009 Share Posted October 16, 2009 This should also work $run = '"c:\documents and settings\Administrator\desktop\testprogram.exe" -a' $result = run($run) msgbox(0, "Result", $result) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now