How to open folder in new tab from the command line?

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
zBernie
Posts: 181
Joined: 08 Dec 2016 17:20

How to open folder in new tab from the command line?

Post by zBernie »

I was researching how to run xyplorer.exe from the command line, pass it a path, and have that open in a new tab. I found the answer below but you can see the error I'm getting. I'm using XYplorer 22.90.0100.

Is there a way to open a folder in a new tab from the command line?


PS C:\Users\bernie> "C:\Program Files (x86)\XYplorer\XYplorer.exe" /script="::focus 'P2'; tab('new', '{C:\Users\bernie}'); #302;"
ParserError:
Line |
1 | "C:\Program Files (x86)\XYplorer\XYplorer.exe" /script="::focus 'P2'; …
| ~
| You must provide a value expression following the '/' operator.

Norn
Posts: 508
Joined: 24 Oct 2021 16:10

Re: How to open folder in new tab from the command line?

Post by Norn »

viewtopic.php?p=195568#p195568
"D:\XYplorer\XYplorer.exe" /script="::focus 'p2'; tab('new', 'G:\Backups');"
Using CMD works fine...

Another way:
viewtopic.php?p=194226#p194226
Windows 11 24H2 @100% 2560x1440

zBernie
Posts: 181
Joined: 08 Dec 2016 17:20

Re: How to open folder in new tab from the command line?

Post by zBernie »

Norn wrote: 19 Mar 2022 21:13 viewtopic.php?p=195568#p195568
"D:\XYplorer\XYplorer.exe" /script="::focus 'p2'; tab('new', 'G:\Backups');"
Using CMD works fine...

Another way:
viewtopic.php?p=194226#p194226
Oddly, regardless of what path I give it, it always opens to "This PC", and no new tab is created. Any ideas?

"C:\Program Files (x86)\XYplorer\XYplorer.exe" /script="::focus 'p2'; tab('new', 'C:\Windows');

RalphM
Posts: 2091
Joined: 27 Jan 2005 23:38
Location: Cairns, Australia

Re: How to open folder in new tab from the command line?

Post by RalphM »

Check your quoting, you're missing a closing ".
Ralph :)
(OS: W11 25H2 Home x64 - XY: Current x64 beta - Office 2024 64-bit - Display: 1920x1080 @ 125%)

zBernie
Posts: 181
Joined: 08 Dec 2016 17:20

Re: How to open folder in new tab from the command line?

Post by zBernie »

RalphM wrote: 20 Mar 2022 01:47 Check your quoting, you're missing a closing ".
Duh, thanks that was it. See how dangerous copy and paste can be! :)

jupe
Posts: 3462
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: How to open folder in new tab from the command line?

Post by jupe »

You must consider reading and referencing the help file to be downright life and death for you then.

zBernie
Posts: 181
Joined: 08 Dec 2016 17:20

Re: How to open folder in new tab from the command line?

Post by zBernie »

jupe wrote: 20 Mar 2022 05:35 You must consider reading and referencing the help file to be downright life and death for you then.
You are hilarious. And completely wrong. I read the section in the manual "Command Line Switches", there is nothing about opening a folder in a new tab. Lots of stuff on command line switches, not what I was after though. Try reading it and you will see what I mean.

highend
Posts: 14966
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: How to open folder in new tab from the command line?

Post by highend »

And looking up tab() didn't come to your mind?
One of my scripts helped you out? Please donate via Paypal

zBernie
Posts: 181
Joined: 08 Dec 2016 17:20

Re: How to open folder in new tab from the command line?

Post by zBernie »

highend wrote: 20 Mar 2022 18:45 And looking up tab() didn't come to your mind?
Searching for "tab()" returns nothing. Searching for "tab" returns dozens of matches, none of which have anything to do with opening a new tab from the command line. Try it yourself. Subsequently, since you cannot search on a page for text, I copied and pasted the entire contents of the section "Command Line Switches". The word tab is there, but not how to open a new tab from the command line.

Make sense now?

highend
Posts: 14966
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: How to open folder in new tab from the command line?

Post by highend »

It doesn't make sense at all.

Maybe instead of posting all that stuff, you SHOULD READ IT^^ Btw, I've removed it from your post, if anyone's interested, the help file provides that^^
1) The path to a script file (commonly called *.xys). The file spec is resolved as in the script command load, so you can skip the XYS extension. You can also skip the path if the XYS file is located in the default scripts folder. For example

XYplorer.exe /script=test

would run the file <xyscripts>\test.xys on startup. If the path contains spaces it must be quoted:

XYplorer.exe /script="C:\Zen\test one.xys"

2) A script. It must be preceded by ::
So does the list of arguments contain a /script= part?
What the hell do you think where tab() can be find in this case?
One of my scripts helped you out? Please donate via Paypal

zBernie
Posts: 181
Joined: 08 Dec 2016 17:20

Re: How to open folder in new tab from the command line?

Post by zBernie »

highend wrote: 20 Mar 2022 20:28 It doesn't make sense at all.

Maybe instead of posting all that stuff, you SHOULD READ IT^^ Btw, I've removed it from your post, if anyone's interested, the help file provides that^^
1) The path to a script file (commonly called *.xys). The file spec is resolved as in the script command load, so you can skip the XYS extension. You can also skip the path if the XYS file is located in the default scripts folder. For example

XYplorer.exe /script=test

would run the file <xyscripts>\test.xys on startup. If the path contains spaces it must be quoted:

XYplorer.exe /script="C:\Zen\test one.xys"

2) A script. It must be preceded by ::
So does the list of arguments contain a /script= part?
What the hell do you think where tab() can be find in this case?
So the "Command Line Switches" section does not explicitly say how to open a folder in a new tab, but rather that you can pass a function on the command line. And that I should have known there was a function named tab().

Post Reply