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
TC on USB and the Buttonbar
Moderators: white, Hacker, petermad, Stefan2
Hello Unitec,
HTH
Roman
Code: Select all
%COMMANDER_DRIVE%
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
PoSh:Buttonbar command automatically Commander_Path _Drive
Hi and welcome to the community.
http://ghisler.ch/board/viewtopic.php?t=19515&highlight=button+commanderpath+automatically
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 ....
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 $_}
.
That is an old question:Unitec wrote:Is ist possible the the Links were Dynamic to the Driveletter ?
http://ghisler.ch/board/viewtopic.php?t=19515&highlight=button+commanderpath+automatically
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 ....
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 $_}
.
Last edited by Stefan2 on 2016-03-31, 08:30 UTC, edited 2 times in total.
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.
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.