Page 1 of 1

[explained] Use of arguments (for CLI)

Posted: 17 Aug 2015 00:17
by hogaty
Usually there is no need to use arguments (CLI).

With use of arguments (description of strange behavior):

Command line interpreter
field executable: there is no problem, all works as expected (notepad, internet explorer,..)
field arguments: first_resolved_argument_is_not_passed <command>

example1:
field arguments: <command>
First argument <command> is not passed to application. In the case when <command> is containing space then
only part after space is passed to executable.

example2: works, but with use first_nonsense_argument only
field arguments: first_nonsense_argument <command>
First_nonsense_argument is not passed to application, <command> is passed to executable.

XYplorer 15.50.206, Windows XP SP3.

Sincerely Hogaty

Re: Use of arguments (for CLI)

Posted: 17 Aug 2015 07:55
by highend
First argument <command> is not passed to application. In the case when <command> is containing space then
only part after space is passed to executable.
Em, quote it correctly?

Never had any problems with command line parameters with XY.

Any real world example where it's failing?

Re: Use of arguments (for CLI)

Posted: 17 Aug 2015 08:54
by Stef123
I've been struggling with this ever since using XY for the first time, with various ups and downs. You'll find numerous help topics for this, such as http://www.xyplorer.com/xyfc/viewtopic. ... 846#p40846

And yet, I ran into problems all over again. My current guidelines have not let me down yet - knock on wood:
  1. Put every component in it's own pair of dual ""double quotes"", no matter how short, no matter whether it contains spaces or not. It may look silly, but do it anyway.
  2. Do not apply step 1 from above if the component qualifies as a parameter. It's my step 2, because I actually remove them, I find it easier to first see all ""components"" clearly seperated, then decide what qualifies as parameters. Never put parameters inside quotes.
  3. Frame the whole thing in one set of "double quotes" - but leave <run> and <;> outside the frame
  4. Frame variables in single 'quotes' when you don't want XY parameters resolved but rendered literally.
Example:

Code: Select all

run """cmd"" /c ""D:\nconvert.exe"" -o ""U:\$NameNew#.jpg"" -resize 1920 0 ""$item""";

Re: Use of arguments (for CLI)

Posted: 17 Aug 2015 09:15
by highend
Stef,

why do you run the cmd in front of nconvert? Unnecessary, nconvert by itself is already a command line tool.

Code: Select all

run """D:\nconvert.exe"" -o ""U:\$NameNew#.jpg"" -resize 1920 0 ""$item""";
is absolutely enough :)

Re: Use of arguments (for CLI)

Posted: 17 Aug 2015 09:47
by Stef123
I simplified it to not make it look even more complicated. The real thing requires it or it won't work.
Besides, it serves as my instruction guideline - meant to also cover cases that - unlike my example here - may cause misbehavings. My goal was a catch-all instruction, the ones I had read elsewhere always failed me in some cases, I wanted to get a foolproof method, once and for all.

FYI - my example is a spin-off from the one you helped me out with - you suggested the dual dbl quotes around ""cmd"" which does work indeed, whereas a simple cmd won't do the trick. Cmd is necessary because the real thing starts like this

Code: Select all

runret("""cmd"" /c ...
And again - it won't work if you leave out the dual set around ""cmd"" - you figured it out eventually. I figured it is good to know about this. Thinking you only need to quote parts with spaces in them doesn't really cut it, too many exceptions.

Re: Use of arguments (for CLI)

Posted: 17 Aug 2015 22:43
by hogaty
Hello

I have described problems related to command line interpreter (GUI configuration of CLI, Tools->Configuration->Colors and Styles->Templates->Command Line Interpreter), namely:

First argument entered into field arguments: is not passed to executable. The First argument is always skipped. Second argument is first argument passed to executable..

I apologize for insufficient description.

Sincerely Hogaty

hogaty wrote:Usually there is no need to use arguments (CLI).

With use of arguments (description of strange behavior):

Command line interpreter
field executable: there is no problem, all works as expected (notepad, internet explorer,..)
field arguments: first_resolved_argument_is_not_passed <command>

example1:
field arguments: <command>
First argument <command> is not passed to application. In the case when <command> is containing space then
only part after space is passed to executable.

example2: works, but with use first_nonsense_argument only
field arguments: first_nonsense_argument <command>
First_nonsense_argument is not passed to application, <command> is passed to executable.

XYplorer 15.50.206, Windows XP SP3.

Sincerely Hogaty

Re: Use of arguments (for CLI)

Posted: 17 Aug 2015 22:49
by highend
Tools->Configuration->Colors and Styles->Templates->Command Line Interpreter
Screenshot of that setting...

Re: Use of arguments (for CLI)

Posted: 17 Aug 2015 23:23
by hogaty
Attachment CLI_settings.gif

Content of address bar is:
!www.paypal.com

Hogaty
highend wrote:
Tools->Configuration->Colors and Styles->Templates->Command Line Interpreter
Screenshot of that setting...

Re: Use of arguments (for CLI)

Posted: 17 Aug 2015 23:49
by highend
WTF?

This setting is meant for the command line interpreter, not for any "normal" application...

Don't know if the arguments field accepts any parameters for other applications...

Re: Use of arguments (for CLI)

Posted: 18 Aug 2015 10:46
by hogaty
Well, it works as expected for CLI C:\Windows\System32\cmd.exe.
Field Arguments must be leaved empty or must contain: /K <command>
But some member of Xyplorer forum had described use C:\Windows\System32\notepad.exe
which was entered into field executable instead a CLI.
Notepad.exe works with empty field Arguments or with <comspec> entered as second
parameter into Field arguments. First parameter in field arguments is skipped.

Conclusion:
Use of executables other than CLI instead CLI ,is unsupported. But in fact it can
somehow work.

Hogaty
highend wrote:WTF?

This setting is meant for the command line interpreter, not for any "normal" application...

Don't know if the arguments field accepts any parameters for other applications...

Re: [explained] Use of arguments (for CLI)

Posted: 20 Aug 2015 12:36
by bdeshi
You can use an alias (read help) to open URL from the addressbar when you also need to pass custom cmd args.

But you can already open an URL by typing it's address directly, just include the protocol prefix: https:// etc.