How to focus/select a file from external cmd prompt

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
jiffypop
Posts: 6
Joined: 09 May 2014 11:16

How to focus/select a file from external cmd prompt

Post by jiffypop »

Hello,

I know I'm going to feel really stupid when I get the answer but I have been searching for 2 days and can't figure this out.

I'm using Everything search engine. How do I mimic the behavior of Explorer's command:

Code: Select all

$exec("explorer.exe" /select,"%1")
In other words I want XYplorer to open the parent folder and focus/select the file I'm pointing to (%1) in Everything's window. Whatever I've tried I get the parent folder with nothing selected, or simply invalid path. (I've tried toggling XYP as "Default File Manager" too.)

Everything offers variables %1, $namepart, $parent, and $=escape for it's "Open Path" command. Here's the closest I've come (Don't laugh!!)

Code: Select all

$exec($parent("A:\MyData\XYplorer\xyplorer.exe" "%1")$namepart("::sel"))
Should I be looking at this script instead? Get cmd result DIRECTLY

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

Re: How to focus/select a file from external cmd prompt

Post by highend »

You mean:
Options - General - Context Menu - Open Path?

Code: Select all

$exec("A:\MyData\XYplorer\xyplorer.exe" "%1")
One of my scripts helped you out? Please donate via Paypal

bauxite69
Posts: 7
Joined: 07 May 2014 01:11

Re: How to focus/select a file from external cmd prompt

Post by bauxite69 »

jiffypop wrote:Hello,

I know I'm going to feel really stupid when I get the answer but I have been searching for 2 days and can't figure this out.

I'm using Everything search engine. How do I mimic the behavior of Explorer's command:

Code: Select all

$exec("explorer.exe" /select,"%1")
$exec(xyplorer.cmd "%1")

xyplorer.cmd

Code: Select all

@echo off
start "XYplorer Here" "C:\Program Files (x86)\XYplorer\XYplorer.exe" /win=normal %1

jiffypop
Posts: 6
Joined: 09 May 2014 11:16

Re: How to focus/select a file from external cmd prompt

Post by jiffypop »

bauxite69 wrote: $exec(A:\MyData\xyplorer\xyplorer.cmd "%1")

xyplorer.cmd

Code: Select all

@echo off
start "XYplorer Here" "A:\MyData\XYplorer\XYplorer.exe" /win=normal %1
Yes! That worked. Thank you!!!!!

I made it portable by using the whole path: (Changed above in the quote.) It worked when I put xyplorer.cmd in C:\Windows, however it did not work when I put "A:\MyData\xyplorer" into my PATH env variable. Not sure why but I don't care because that wouldn't be portable anyway.

I will be quoting you in the Voidtools Everything forum.

@highend: Thank you for your help too.

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

Re: How to focus/select a file from external cmd prompt

Post by highend »

Why should you use an additional batch file if you can get the same result with a direct command instead *just wondering*...
One of my scripts helped you out? Please donate via Paypal

jiffypop
Posts: 6
Joined: 09 May 2014 11:16

Re: How to focus/select a file from external cmd prompt

Post by jiffypop »

I believe I tried the simple xyplorer.exe %1 command. It didn't work. I'll try again...

Update: Dho! I told you I would feel stupid. Indeed! :oops:

I think I was using $exec($parent("%1")) before, so I assumed it was exactly the same as xyplorer.exe %1. Weird.


Post Reply