Do user commands support relative paths?

Discussion & Support for xplorer² professional

Moderators: fgagnon, nikos, Site Mods

User avatar
FrizzleFry
Platinum Member
Platinum Member
Posts: 1241
Joined: 2005 Oct 16, 19:09

Post by FrizzleFry »

Try a user command like

>"%x2path%editor2_UC.exe"

Removing the \ after the second % in case the extra \ is screwing things up...

my x2 path has no spaces... but I will test that now...

a question for sanity sake: do you have editor2_UC.exe in the x2 folder?

That >editor2_UC.exe works just means the x2 folder is in the path, or the x2 folder is the is in the active pane/tab. That would not be the case if you are trying to do this from a USB key and browsing other folders.
Last edited by FrizzleFry on 2008 Apr 16, 20:18, edited 1 time in total.
desslok
Bronze Member
Bronze Member
Posts: 167
Joined: 2008 Jan 16, 22:10

Post by desslok »

Yea, sorry, I don't have the portable version yet. I was doing it form the installed version  :lol:
User avatar
FrizzleFry
Platinum Member
Platinum Member
Posts: 1241
Joined: 2005 Oct 16, 19:09

Post by FrizzleFry »

It actually worked for me with an x2 path with spaces with or without quotes and also with or without the extra \

To fgagnon: this discussion should probably be split off to its own thread, we have gotten pretty far from "backup or transfer your settings". I would say at desslok's first post. Thanks.
pj
Gold Member
Gold Member
Posts: 479
Joined: 2006 Jan 26, 14:01
Location: Florida

Post by pj »

desslok wrote: Edit:

Code: Select all

>editor2_UC.exe
This works
I believe your "fix" will stop working once you execute any program from within XPLORER2 that will cause it to change the CWD somewhere else.

To check, press F10 [enter] and see what the current path is when you first start up XPLORER2.  The CWD should be the directory where the XPLORER2 exe file is located.

Now, close that command window, navigate to any file with a program association (.DOC, .XLS, .PDF, etc.) and press [enter] to execute the program on that file.  From XPLORER2, presss f10 [enter] again and the CWD should now be the directory where the file or program is located, e.g. "C:\Documents and Settings\{username}\My Documents"  if you opened a document from your My Documents folder.

Using Fizz's suggestion to remove the extra "" from your command line should correct the problem permanently.

Ahhhh, reminising over the BATCH "programming" language - takes me back to when real programmers knew just how much could be done with the FOR command and redirection....
PJ in (sunny) FL

"The hardest thing to admit is what you don't know"
desslok
Bronze Member
Bronze Member
Posts: 167
Joined: 2008 Jan 16, 22:10

Post by desslok »

pj wrote:I believe your "fix" will stop working once you execute any program from within XPLORER2 that will cause it to change the CWD somewhere else.
This "fix" continues to work :D
pj wrote:Using Fizz's suggestion to remove the extra "" from your command line should correct the problem permanently.
No, that didn't do anything. The problem is, as FrizzleFry pointed out, I was doing it from the installed version  :D
User avatar
FrizzleFry
Platinum Member
Platinum Member
Posts: 1241
Joined: 2005 Oct 16, 19:09

Post by FrizzleFry »

That you are running from the install folder is not a problem. This method should work. But it's probably why your fix works. Your fix most likely will not work if you are running x2 from a USB key on a system that does not have x2 installed.

What version of x2 are you running?

Is editor2_UC.exe is this folder: C:\Program Files\zabkat\explorer2\?

Do you have editor2_UC.exe is a folder that is in your PATH?
Last edited by FrizzleFry on 2008 Apr 17, 16:19, edited 1 time in total.
desslok
Bronze Member
Bronze Member
Posts: 167
Joined: 2008 Jan 16, 22:10

Post by desslok »

FrizzleFry wrote:That you are running from the install folder is not a problem. This method should work.
It works. But user command is different from the one you suggested earlier.
What version of x2 are you running?
1.7.1.2
Is editor2_UC.exe is this folder: C:\Program Files\zabkat\explorer2\?
Yes.
Do you have editor2_UC.exe is a folder that is in your PATH?
Look at my post above.

Code: Select all

2path=C:\Program Files\zabkat\explorer2\
User avatar
FrizzleFry
Platinum Member
Platinum Member
Posts: 1241
Joined: 2005 Oct 16, 19:09

Post by FrizzleFry »

Is C:\Program Files\zabkat\explorer2\ in your PATH?

PATH is the list of folders in which Windows looks for executables.

open a command line and type path
User avatar
FrizzleFry
Platinum Member
Platinum Member
Posts: 1241
Joined: 2005 Oct 16, 19:09

Post by FrizzleFry »

An improvement to the batch file is to use the following to execute x2:

start xplorer2_UC.exe /P

the /P switch forces x2 to run in a new process so it will inherit the x2path even if there are other x2 instances running.
desslok
Bronze Member
Bronze Member
Posts: 167
Joined: 2008 Jan 16, 22:10

Post by desslok »

FrizzleFry wrote:Is C:\Program Files\zabkat\explorer2\ in your PATH?
Nope.
User avatar
FrizzleFry
Platinum Member
Platinum Member
Posts: 1241
Joined: 2005 Oct 16, 19:09

Post by FrizzleFry »

I tried your fix and it works!

x2 seems to look in its folder for user command executables. Nikos will have to confirm that. If this is the case then the whole batch file thing is unnecessary.

I have tried it with a few programs (other than editor2) and it works :)

The real test would be to try it from a USB key with the portable version but I do not have it either.
Mr.Pleasant
Silver Member
Silver Member
Posts: 281
Joined: 2006 Dec 29, 12:56
Location: Utrecht, NL

Post by Mr.Pleasant »

Wow! Lately I've been hurting my brain how issue User Commands from x2 portable that refer to other executables also on my usb drive, with the ever changing drive letters. This works! I didn't know the path set in a batch file to start up x2 is passed to x2 itself. Great!
I would use %~d0 (instead of %~dp0) in the pathsetting though, this makes it easier to construct paths to executables in sibling folders of the x2 install folder. %~d0 refers to the drive letter from which the batch file is run.

Still I would like it, if possible, to have some $-token to refer to the x2 installation-drive or path  :)
Robert2
Gold Member
Gold Member
Posts: 673
Joined: 2004 Jun 17, 15:39

Post by Robert2 »

Mr.Pleasant wrote:Wow! Lately I've been hurting my brain how issue User Commands from x2 portable that refer to other executables also on my usb drive, with the ever changing drive letters. This works! I didn't know the path set in a batch file to start up x2 is passed to x2 itself. Great!
I would use %~d0 (instead of %~dp0) in the pathsetting though, this makes it easier to construct paths to executables in sibling folders of the x2 install folder. %~d0 refers to the drive letter from which the batch file is run.
By the way, this was already discussed last July. Have a look at http://forum.zabkat.com/viewtopic.php?t=52 ... sc&start=0
Ian
Member
Member
Posts: 44
Joined: 2008 Jan 03, 22:04

Post by Ian »

Mr.Pleasant wrote:$-token to refer to the x2 installation-drive or path
I think path to where the x2 executable that being run is the way. So, users could use it on PCs that have never been installed with x2.
User avatar
FrizzleFry
Platinum Member
Platinum Member
Posts: 1241
Joined: 2005 Oct 16, 19:09

Post by FrizzleFry »

I agree that having the drive that x2 is in is more useful. That is the nice thing of the batch file method: you choose what to pass to the x2 process.

A token for the x2 drive is a good idea. It would be a consistent x2 way to deal with the removable drive dilemma.
Post Reply