How does TextPad "find" cmd.exe and/or command.com

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
cxhamilton
Posts: 7
Joined: Sat Dec 06, 2003 11:54 pm
Location: Duluth, GA USA

How does TextPad "find" cmd.exe and/or command.com

Post by cxhamilton »

I found a poll that asks how important is the ability to configure the command processor that TextPad uses to execute user (or built-in) tools, but I did not see an explanation on how TextPad goes about executing cmd.exe/command.com.

Does it:

1. Determine the OS and launch the command, assuming that it exists in a PATH directory?

2. Determine the OS and launch the full path to the command based on the known location?

3. Use an environment variable? (I believe that I have ruled this one out, but thought I would mention it anyhoo)

4. Black magic!?! :twisted:

I am asking, because I would very much like to use 4NT as the command processor for a couple of VSS-related tools that I have defined. The rub is that the Microsoft command processor does not support UNC paths as current directories.

I could write a batch file or Perl script that accepts $FileDir as an argument and changes the directory within the context of the script. I could even map the UNC paths to network drives ... but that does not answer my question, does it?

Thanks!
-Chris
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Why not specify 4nt as the program to be executed?

I use the following tool often. It opens a 4nt session starting in the directory of the current document:
Command: c:\4nt\4nt.exe
Parameters:
Initial folder: $FileDir

[x] Close DOS window on exit
cxhamilton
Posts: 7
Joined: Sat Dec 06, 2003 11:54 pm
Location: Duluth, GA USA

Post by cxhamilton »

I have tried that with unsatisfactory results. Regardless of which command you "define" in the Tools menu, TextPad creates a temporary batch file, in $FileDir that contains the command you ultimately want to execute, its parameters, etc. The batch file is always executed by cmd.exe/command.com. Which does not support UNC paths.
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Exactly how are you specifying your tool? Nothing like that happens here.
cxhamilton
Posts: 7
Joined: Sat Dec 06, 2003 11:54 pm
Location: Duluth, GA USA

Post by cxhamilton »

It appears that I was partially mistaken in that TextPad does not always create a batch file. If "Close DOS window on exit" option is NOT checked, TextPad will create a batch file that uses the PAUSE command to keep the Tool from finishing.

So, I've gotten TextPad to execute 4NT directly ... which solves part of the problem. Now I have to figure out how to get the current project in VSS changed to $FileDir before the VSS checkout command is executed.

P.S. I'd still like to know how TextPad "finds" cmd.exe/command.com.

Thanks for your responses Ben!
bveldkamp

Post by bveldkamp »

cxhamilton wrote:
P.S. I'd still like to know how TextPad "finds" cmd.exe/command.com.
Most programs I know of use the %COMSPEC% environment variable to find the correct command processor.
cxhamilton
Posts: 7
Joined: Sat Dec 06, 2003 11:54 pm
Location: Duluth, GA USA

Post by cxhamilton »

TextPad does not use %ComSpec%
bveldkamp

Post by bveldkamp »

How do you know that?

Maybe TP has some sort of backup mechanism, if COMSPEC doesn't exist or points to a non existing file, try to find cmd.exe or command.com in %WINDIR% (or in %PATH%, whatever).
cxhamilton
Posts: 7
Joined: Sat Dec 06, 2003 11:54 pm
Location: Duluth, GA USA

Post by cxhamilton »

bveldkamp wrote:How do you know that?
I've modified %ComSpec% on both the system and user-level and cmd.exe is still being launched.
bveldkamp

Post by bveldkamp »

Just checking, did you restart TP after you modified comspec?
cxhamilton
Posts: 7
Joined: Sat Dec 06, 2003 11:54 pm
Location: Duluth, GA USA

Post by cxhamilton »

Yup!
bveldkamp

Post by bveldkamp »

OK, I guess you're right then and TP doesn't use COMSPEC. I have no idea why they wouldn't do that, though.
User avatar
bbadmin
Site Admin
Posts: 878
Joined: Mon Feb 17, 2003 8:54 pm
Contact:

Post by bbadmin »

If the COMSPEC environment variable is defined when a new DOS tool is added, then whatever it references is used, otherwise TextPad uses CMD.EXE on NT/Win2K/XP and COMMAND.COM on Win9X/ME.

Keith MacDonald
Helios Software Solutions
Post Reply