Question about "Run" script command

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
Lare2
Posts: 65
Joined: 18 Sep 2006 08:29

Question about "Run" script command

Post 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. :)

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Question about "Run" script command

Post 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';

Lare2
Posts: 65
Joined: 18 Sep 2006 08:29

Re: Question about "Run" script command

Post 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

admin
Site Admin
Posts: 60531
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Question about "Run" script command

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

Post Reply