%tcmd% vs. CDO

Apr 4, 2010
57
0
%tcmd% gives us the full path to tcmd.exe, and Vince's CDH will take us to the TC main directory, but do we have a variable for the TC main directory itself, i.e. the same as %tcmd% but without 'tcmd.exe' on the end? I'd use it like this (if the variable existed):

cdd %tcmdpath%

would do the same as:

cdh.

I make a lot of virtual drives to point to important paths, eg:

subst v: "c:\program files\jpsoft\tcmd11\"

but it would be nicer to:

subst v: %tcmdpath%

if it existed.
 
May 20, 2008
11,378
98
Syracuse, NY, USA
On Sun, 30 May 2010 00:34:39 -0400, rayandrews <> wrote:

|%tcmd% gives us the full path to tcmd.exe, and Vince's CDH will take us to the TC main directory, but do we have a variable for the TC main directory itself, i.e. the same as %tcmd% but without 'tcmd.exe' on the end? I'd use it like this (if the variable existed):
|
|cdd %tcmdpath%

For now, how about: %@PATH[%_CMDSPEC] That should do it. If you don't like
the trailing backslash, use %@LEFT[-1,%@PATH[%_CMDSPEC]].

v:\> echo %@PATH[%_CMDSPEC]
D:\TC11\

v:\> echo %@LEFT[-1,%@PATH[%_CMDSPEC]]
D:\TC11


To be precise, CDH takes you to the directory where (the current process's)
TCC.EXE resides.

I could easily add such a variable to 4UTILS. Perhaps it could be the start of
your first plugin. It's not hard. I believe this would work.

INT WINAPI _TCCPATH( WCHAR *psz )
{
GetModuleFileNameEx(GetCurrentProcess(), NULL, psz, MAX_PATH);
*wcsrchr(psz, L'\\') = 0;
return 0;
}

P.S. In writing plugins, facility with the WIN32 API functions and Unicode are
necessary. A working knowledge comes pretty fast.
--
- Vince
 
May 20, 2008
11,378
98
Syracuse, NY, USA
All I said is true, but it's not going to help with your ultimate goal of using SUBST. SUBST will not expand variables. So just figure out where TCC resides ( %@left[-1,%@path[%_cmdspec]] ) once and for all and SUBST v: to that directory. If you have several TCCs installed you can't have v: refer to the home directory of whatever one happens to be running at the moment.

%tcmd% gives us the full path to tcmd.exe, and Vince's CDH will take us to the TC main directory, but do we have a variable for the TC main directory itself, i.e. the same as %tcmd% but without 'tcmd.exe' on the end? I'd use it like this (if the variable existed):

cdd %tcmdpath%

would do the same as:

cdh.

I make a lot of virtual drives to point to important paths, eg:

subst v: "c:\program files\jpsoft\tcmd11\"

but it would be nicer to:

subst v: %tcmdpath%

if it existed.
 
Nov 2, 2008
231
2
Subst has no problems with subst z: %temp% or %ProgramFiles%

[Z:\]ver

4NT 8.01.70 Windows 2000 [Version 5.0.2195]

Code:
[H:\PROGRAM\ComPlus Applications]subst z: "%_cwd"

[H:\PROGRAM\ComPlus Applications]subst
Z:\: => H:\PROGRAM\ComPlus Applications

Something like "%comspec\.." or "%tcmd%\.." does quite nicely, even though one of the directories is a file.
 
May 20, 2008
3,515
4
Elkridge, MD, USA
----- Original Message -----
From: "w_krieger" <>
To: <ESFabian@comcast.net>
Sent: 2010. May 30., Sunday 04.18
Subject: RE: [Support-t-2006] Re: %tcmd% vs. CDO



> Subst has no problems with subst z: %temp% or %ProgramFiles%
>

True, but what Vince was referring to was that if you have concurrent
instances of different versions of 4NT and TCC, v: can be a SUBST only for
one of them, not all. OTOH an internal variable, e.g., _cmdpath, could exist
that is correct in each instance, and so could a command which is logically
equivalent to

alias cdi=`*cd %@path[%_cmdspec]`
--
Steve
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,446
88
Albuquerque, NM
prospero.unm.edu
For now, how about: %@PATH[%_CMDSPEC] That should do it. If you don't like the trailing backslash, use %@LEFT[-1,%@PATH[%_CMDSPEC]].

I could easily add such a variable to 4UTILS. Perhaps it could be the start of your first plugin. It's not hard. I believe this would work.

A plugin may be overkill; this is one of the things that aliases are great for:

Code:
alias shell:=`%@path[%_cmdspec]`

An alias like this can be used by itself, as a command, to switch to the shell's directory; or at the start of filenames passed to internal commands, much like a drive letter. External commands won't understand it, but if you press Tab for filename completion, the alias will be expanded to a regular pathname.
 
Apr 4, 2010
57
0
----- Original Message -----
From: "w_krieger" <>
To: <esfabian@comcast.net>
Sent: 2010. May 30., Sunday 04.18
Subject: RE: [Support-t-2006] Re: %tcmd% vs. CDO





True, but what Vince was referring to was that if you have concurrent
instances of different versions of 4NT and TCC, v: can be a SUBST only for
one of them, not all. OTOH an internal variable, e.g., _cmdpath, could exist
that is correct in each instance, and so could a command which is logically
equivalent to

alias cdi=`*cd %@path[%_cmdspec]`
--
Steve

It seems that there are a host of ways to do this, and I found another one:

subst v: %@quote[%comspec\..%]

but it still seems to me that there should be a built in variable.



</esfabian@comcast.net>
 
May 20, 2008
3,515
4
Elkridge, MD, USA
----- Original Message -----
From: "Charles Dye" <>

> Code:
> ---------
> alias shell:=`%@path[%_cmdspec]`
> ---------
> An alias like this can be used by itself, as a command, to switch to the
> shell's directory; or at the start of filenames passed to internal
> commands, much like a drive letter. External commands won't understand
> it, but if you press Tab for filename completion, the alias will be
> expanded to a regular pathname.

I started to write that the delayed expansion forced by the backticks is not
needed in this case, but I realized that it is needed if you use more than
one version of the command interpreter, AND you use global aliases, as each
the shared alias definition would be expanded differently by each 4nt/tcc
version. IF you use only a single version, OR if you use local aliases, you
can drop the backticks.
--
Steve
 
Similar threads
Thread starter Title Forum Replies Date
vefatica TCMD hides itself! Support 3
vefatica Tray min'd TCMD and ACTIVATE Support 6
C How to? starting TCC/TCMD v25 Support 2
CWBillow TCC and TCMD in Powershell Support 6
kb6ojs How to? "Specified Account Already Exists" error installing TCMD v27 Support 12
CWBillow TCMD Colors Support 8
Jay Sage Issues With TCMD File Explorer Support 0
C Last TCMD that supports win 7? Support 5
gentzel TCMD background color confusion Support 6
R Upgrade TCMD 19 to TCC 26 Support 1
Alpengreis Remaining TCMD background process (v26) ... Support 19
S Windows Server version not being detected correctly in TCMD 26RC2 Support 9
G TCMD crash when copy Support 3
Joe Caverly DrawVLine results different in TCMD tab and detached TCC Support 11
Alpengreis [TCMD v25.00.24] Small space problem with the DE translation in Prefs-GUI Support 1
Alpengreis [TCMD v25.00.24] Problem with copy and paste and the # char via mouse in TCC Support 6
Jay Sage TCMD Crashes with "tctoolbar /c /r file" Support 5
nikbackm TCMD 25 - Unregister older TCMD version Support 2
G Documentation on TCMD.INI Support 9
R New Clear Buffer in TCMD Home Menu Support 2
CWBillow Back up TCMD tabs Support 2
CWBillow Upgrade Windows 10's effect on TCMD and TCC Support 3
DrusTheAxe TCMD 24.02.49 x64 crashed due to DivideByZero :-( Support 4
A After update to 24.02.49, helpfile tcmd.chm hangs when opened Support 0
David McClelland TCMD 24 & Perl - perl thinks it's own executable is ...\TCMD24\TCC.EXE??? Support 3
dcantor How to? Can 32-bit TCC be run on a system with 64-bit TCMD and TCC installed? Support 6
W pdir returns diff results between tcc and tcmd - one is an error msg Support 5
vefatica What's TCMD's problem with ^e[0m? Support 13
CWBillow TCMD PowerShell Tab elevated Support 6
A How to? Copy+Paste in TCMD tabs with Ctrl-Shift-Ins? Support 5
vefatica TCMD output invisible on Win10 Support 22
J Moving from TCC v22 to TCMD v24 issues Support 3
RChrismon How to? Copy TCMD.INI to New Version Support 7
rps TCMD OPTIONS dialog Support 2
rps TCMD Tabs priority option setting Support 0
D Can we fix the scaling for TCmd? Support 14
CWBillow TCMD Tab Defs Support 4
A How to? TCMD Configuration Dialog: 'Smooth Scrolling' Option missing? Support 1
A Fixed [23.0.22]: TCMD crashes shortly after start, TCC keeps running in background Support 6
A TCMD - Dir Command puts out blank lines? Support 16
P Symantec Endpoint Protection trapped TCMD.EXE and said it contained WS.Reputation.1 (Virus?) Support 3
Emilio III TCMD Tab titles on Insider Windows Support 2
kb6ojs Want to start TCMD v20 with every Windows 10 bootup Support 3
D Tcmd 22.00.42 - annoying desktop refresh Support 47
CWBillow Context menu extensions for TCC/TCMD v18? Support 1
vefatica Pasting into TCMD via right-click menu? Support 2
M Please explain TCMD's ANSI x3.64 support Support 4
CWBillow Powershell tab in TCMD? Support 2
D Custom ini-file is not read, by tcmd.exe cli Support 6
R TCC-RT with TCMD installed Support 6

Similar threads