%tcmd% vs. CDO

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
Apr 4, 2010
57
0
#1
%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.
 
#2
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
 
#3
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
180
0
#4
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.
 
#5
----- Original Message -----
From: "w_krieger" <>
To: <[email protected]>
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
3,483
44
Albuquerque, NM
prospero.unm.edu
#6
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
#7
----- Original Message -----
From: "w_krieger" <>
To: <[email protected]>
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.



</[email protected]>
 
#8
----- 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