%COMMANDER_DRIVE% variable in "Parameters" input b

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
obmana
Junior Member
Junior Member
Posts: 53
Joined: 2013-08-28, 15:35 UTC

%COMMANDER_DRIVE% variable in "Parameters" input b

Post by *obmana »

If I use %COMMANDER_DRIVE% variable in "Command" input box in "Change Start Menu" dialog, it expands as expected. But if I try to use same variable in "Parameters" input box it doesn't expand.

Is there any way I reference file on portable device in "Parameters" input box?
I would also appreciate any reasonable advice, if TC doesn't provide way out.

TIA
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48079
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

You cannot use environment variables in "parameters" because they collide with placeholders like %P%N. But you can put parameters in "command" input box if you use double quotes correctly, e.g.

"%COMMANDER_Path%\Program name" "%COMMANDER_DRIVE% and other stuff" other_parameter
Author of Total Commander
https://www.ghisler.com
obmana
Junior Member
Junior Member
Posts: 53
Joined: 2013-08-28, 15:35 UTC

Post by *obmana »

Thanks for your fast reply

I already tried that, and although it shows flexibility it isn't applicable for my example. I'm trying to run libxml's "xsltproc.exe" and apply transformation from xslt located on portable device, while xsltproc usage is this:

Code: Select all

xsltproc.exe [options] stylesheet file [file ...]
Or in my example:

Code: Select all

xsltproc.exe --output some-file.xml --novalid %COMMANDER_DRIVE%\XSLT\my_transform.xsl some-file.xml
So I can use "%COMMANDER_DRIVE%\XSLT\my_transform.xsl" in "Command" input box to reference my transformation, but I would have to set "--output" before it, while I want to use "%O" for output xml file (which can't be used in "Command" input box)

Sorry if my explanation seem complicated, I guess I need to wrap this process in batch script instead, but I thought to ask first in case I miss something.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48079
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

In fact this isn't possible directly. You will have to write a small batch file or cmd script which changes the order of the parameters.
Author of Total Commander
https://www.ghisler.com
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Something like this should work:

Code: Select all

Command=%ComSpec%
Parameters=/c "title xsltproc & "X:\Path\To\xsltproc.exe" --output "%P%O (out).%E" --novalid %%COMMANDER_DRIVE%%\XSLT\my_transform.xsl "%P%O.%E""
Minimized=Yes or No
obmana
Junior Member
Junior Member
Posts: 53
Joined: 2013-08-28, 15:35 UTC

Post by *obmana »

Thanks for your replies

Yes, it was something very similar to lines posted by MVV which seem like something I should have posted to complete this thread...

I thought to reply in case it's "useful" that while setting up Saxon processor I needed to use jar protocol and I was missing URI reference to focused file. This also can be set by batch operators, by replacing backslashes to slashes, although for some reason I thought that TC offers placeholder for it, but I can't see it in help file.

Working example:

Code: Select all

@echo off
rem Command:    cmd /k %COMMANDER_DRIVE%\XML\xslt\style-transform.cmd %COMMANDER_DRIVE%
rem Parameter: %P%N
set uri=%2
set uri=%2:\=/%
set xslt=%1\XML\xslt\style-transform.xslt
set xslt=%xslt:\=/%

%1\java\jre\bin\java.exe -cp %1\SaxonHE9\saxon9he.jar net.sf.saxon.Transform -xsl:%xslt% -u jar:file:///%uri%!/word/document.xml -o:%~n2.xml
Post Reply