Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

%tcmd% vs. CDO

Apr
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.
 
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
 
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.
 
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.
 
----- 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
 
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.
 
----- 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]>
 
----- 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

Back
Top