Jump to content

Something buggy with Run and doublequotes?


nikink
 Share

Recommended Posts

Hiya folks, I dunno if this is a bug or not, but

; This one doesn't work
RunWait(@ComSpec & ' /c "' & @ProgramFilesDir & '\company\sub dir\program.exe" -a "' & @ScriptDir & '\Activation.xml" -d proxy.url.comu >> "C:\info.txt"')

; This one works
RunWait(@ComSpec & ' /c C:\Progra~1\company\subdir~1\program.exe -a "' & @ScriptDir & '\Activation.xml" -d proxy.url.com >> "C:\info.txt"')

so, yeah. The first example in my script looks good, but never worked and after using /k instead of /c I saw it was failing to read the double-quotes. So I had to resort to method 2 and eliminate all spaces in the path so that quotes weren't necessary - then it worked. If I manually type the command line with the double-quotes, it works.

So, maybe this is a bug with 3.2.1.3?

Link to comment
Share on other sites

Hiya folks, I dunno if this is a bug or not, but

; This one doesn't work
RunWait(@ComSpec & ' /c "' & @ProgramFilesDir & '\company\sub dir\program.exe" -a "' & @ScriptDir & '\Activation.xml" -d proxy.url.comu >> "C:\info.txt"')

; This one works
RunWait(@ComSpec & ' /c C:\Progra~1\company\subdir~1\program.exe -a "' & @ScriptDir & '\Activation.xml" -d proxy.url.com >> "C:\info.txt"')

so, yeah. The first example in my script looks good, but never worked and after using /k instead of /c I saw it was failing to read the double-quotes. So I had to resort to method 2 and eliminate all spaces in the path so that quotes weren't necessary - then it worked. If I manually type the command line with the double-quotes, it works.

So, maybe this is a bug with 3.2.1.3?

that's not a bug in autoit. Run both of your commands in a DOS box and see what happens...

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Link to comment
Share on other sites

If I run:

"C:\Program Files\company\sub dir\program.exe" -a "' & @ScriptDir & '\Activation.xml" -d proxy.url.com >> "C:\info.txt"

from a dosbox, it works...

What am I missing?

see "help cmd" in a dos box. Search for /s and the way " is handled by cmd.exe if you give the option /c or /k.

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Link to comment
Share on other sites

Ok... I'm reading that and getting quite lost. But I presume the important bit is where it says if there are more than exactly 2 "s on the cmdline, then things go wrong, and since mine has 6, I'm screwed...

So, is there a way around this? It seems inelegant to use the ~1 abbreviations...

Link to comment
Share on other sites

Ok... I'm reading that and getting quite lost. But I presume the important bit is where it says if there are more than exactly 2 "s on the cmdline, then things go wrong, and since mine has 6, I'm screwed...

So, is there a way around this? It seems inelegant to use the ~1 abbreviations...

yes, use " (double quotes) just for the executable and ' (single quotes) for the other parameters. That should work. Another option would be to use ShellExecute().

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

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