Page 1 of 1

Question about "Run" script command

Posted: 24 Sep 2009 01:41
by Lare2

Code: Select all

cmd /k "D:\Portable Programs\XYplorer\wget\wget.exe" --help
If I run the above code under the windows dialog it does work as expected. The wget help manual comes up on a cmd window.

When i tried doing the same under XYplorer using the run script command it doesn't work. I'm pretty sure its something really easy like some quoting or something similar.

Code: Select all

run cmd /k "D:\Portable Programs\XYplorer\wget\wget.exe" --help
Anyone have a clue. :)

Re: Question about "Run" script command

Posted: 24 Sep 2009 02:02
by TheQwerty
Indeed it's quoting... Try:

Code: Select all

run """cmd"" /k ""D:\Portable Programs\XYplorer\wget\wget"" --help";
or if you don't need to resolve any variables you could use single quotes to avoid the need to escape:

Code: Select all

run '"cmd" /k "D:\Portable Programs\XYplorer\wget\wget" --help';

Re: Question about "Run" script command

Posted: 24 Sep 2009 03:12
by Lare2
thanks TheQwerty

I knew it was related to the quotes. Where can i look to learn more about how the quotes affect the scripts. Is there something on the wiki that cover the proper use of quotes.

--edit--

Ooops, seems the wiki still not loading... So i'll dive into the help file for now

Re: Question about "Run" script command

Posted: 24 Sep 2009 10:15
by admin
Lare2 wrote:Where can i look to learn more about how the quotes affect the scripts.
Quoting the help file on quoting:
Using Quotes in Scripting

It's strongly recommended that you (double- or single-) quote your strings! While the script engine is currently still permissive with unquoted strings (msg Hi! works) this might not be so in the future, so you better do msg "Hi!" right away!

Here's the basic laws of quoting:

(1) Everything is either in double-quotes, or in single-quotes, or outside of any quotes.
(2) To have double-quotes inside double-quotes they must be doubled.
(3) To have single-quotes inside single-quotes they must be doubled.
(4) Variables are resolved in double-quotes and outside of any quotes, but not in single-quotes.
There's also a function quote() which can help you avoid too many doubled double quotes...