Page 1 of 1

TC on USB and the Buttonbar

Posted: 2016-03-30, 18:57 UTC
by Unitec
First sorry for my bad English.

I have the TC running on an USB Device.

When i add an Programm ( on the same usb device ) to the Buttonbar the Link shows to Driveletter/Dir/Programm.
So the Button will only works with that Driveletter.
But each PC gives an other Driveletter.

Is ist possible the the Links were Dynamic to the Driveletter ?

At the moment i have to edit the Buttonbar Links by hand to %commanderpath% .

Could this be Automatet when the TC is Installed on an USB Device and started via starttc.exe

Thanks for your Time to read tis post.

Regards Unitec

Posted: 2016-03-30, 20:16 UTC
by Hacker
Hello Unitec,

Code: Select all

%COMMANDER_DRIVE%
HTH
Roman

PoSh:Buttonbar command automatically Commander_Path _Drive

Posted: 2016-03-31, 07:03 UTC
by Stefan2
Hi and welcome to the community.
Unitec wrote:Is ist possible the the Links were Dynamic to the Driveletter ?
That is an old question:
http://ghisler.ch/board/viewtopic.php?t=19515&highlight=button+commanderpath+automatically

:D and still no solution for this issue.

But the buttons are stored in a *.bar file in the TC folder, ("DEFAULT.BAR" on default)
which is a plain TEXT file and can be edited with an text editor: search&replace .... :wink:






Usually, I write a small script to
[face=timesnewroman]-- $CurrPath = GetEnvVar("%Commander_Path%") #get actual TC path
---- for each *.bar file
---- ---- for each line in BAR do
---- ---- $Line.replace $CurrPath by literal "%Commander_Path%" string[/face]
(pseudo code)




For example with PowerShell

In TC open PowerShell console. Be sure to be in *main* TC folder where the 'TOTALCMD.EXE' is

First, backup the *.bar's:
mkdir C:\Temp\TC-Bars; Dir -rec *.bar|ForEach{Copy $_ C:\Temp\TC-Bars\}

Now modify the *.bar's to use "%Commander_Drive%": by exchanging actual path with env var %xxx%
dir -fi *.bar |ForEach{$Cont=(GC $_).Replace(($env:Commander_Drive),"%Commander_Drive%");Out-File -enc ASCII -input $Cont -file $_}


Or, for all subfolders, use 'dir -recurse ':
dir -rec -fi *.bar | ........




To use "%Commander_PATH%":
dir -rec -fi *.bar |ForEach{$Cont=(GC $_).Replace(($env:Commander_Path),"%Commander_Path%");Out-File -enc ASCII -input $Cont -file $_}




.

Posted: 2016-03-31, 07:14 UTC
by MVV
Currently TC converts paths to %COMMANDER_PATH% when you drag programs from TC folder to a buttonbar, but it doesn't convert paths to %COMMANDER_DRIVE%.
So if one wants automatic drive letter conversion, he may try moving programs to some subfolder of TC folder on USB stick to enable paths to %COMMANDER_PATH% conversion.
However it may be really more convenient just to run script sometimes to convert drive letters to %COMMANDER_DRIVE% in all buttonbar files on USB stick.

Posted: 2016-04-02, 18:13 UTC
by Unitec
Im Sorry that im bringing Up an Old Question.

Thanks for your Time and Help.