Page 1 of 1

How to focus/select a file from external cmd prompt

Posted: 10 May 2014 01:54
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

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

Posted: 10 May 2014 07:34
by highend
You mean:
Options - General - Context Menu - Open Path?

Code: Select all

$exec("A:\MyData\XYplorer\xyplorer.exe" "%1")

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

Posted: 10 May 2014 21:36
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

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

Posted: 12 May 2014 02:04
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.

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

Posted: 12 May 2014 02:29
by highend
Why should you use an additional batch file if you can get the same result with a direct command instead *just wondering*...

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

Posted: 12 May 2014 02:44
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.

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

Posted: 12 May 2014 03:07
by jiffypop