ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Drag&Drop Robot

Suggestion: Use Comspec

(1/5) > >>

myarmor:
Just a small suggestion for an otherwise excellent program..

Instead of statically calling cmd wherever it is needed, please use the ComSpec environment variable to determine what command processor to use (It's been around since ms-dos, and still exists).
The comspec variable always points to the full path of the command processor to use and doesn't contain parameters.

It wouldn't change anything for standard users, but it would for those that want to use an alternate command processor by default.

In my case I prefer to use Take command by jpsoft which is compatible with the normal command processor, but oh so powerful in comparison.

mouser:
Hi myarmor,

This never occurred to me.
Actually D+DR just tells the OS to launch the program, so the OS takes care of it, but perhaps i could have an option to manually specify a replacement command processor.

If you specify the command processor exe on the D+DR commandline before the program to execute, does it work?

Or do you have any alternative explanation for how to launch another exe programmatically using an alternative command processor.  Remember that D+DR needs to capture the output of the processor in some cases which involves remapping the i/o, so i'm curious to know if this will still work ok.

myarmor:
This never occurred to me.
Actually D+DR just tells the OS to launch the program, so the OS takes care of it, but perhaps i could have an option to manually specify a replacement command processor.

If you specify the command processor exe on the D+DR commandline before the program to execute, does it work?

Or do you have any alternative explanation for how to launch another exe programmatically using an alternative command processor.  Remember that D+DR needs to capture the output of the processor in some cases which involves remapping the i/o, so i'm curious to know if this will still work ok.
-mouser (June 06, 2008, 11:40 AM)
--- End quote ---
Yes, D+DR grabs the output as it should when specified on the D+DR commandline.

I'm talking about every time you would normally explicitly call the command processor (as you or a library apparently do with .bat for instance),
not .exe etc extensions.

I have .cmd,.bat and .btm extensions assigned to run with "c:\program files\jpsoft\tcmd9\tcc.exe".
The comspec variable is also assigned that path, so no matter what, everything running a batchfile one way or another
would run with TCC instead of XP's command processor.

I did some testing by creating a small batch file (test.bat) containing only VER
then dropped a file in D&DR, and ran it. It shows XP's command processor:

Microsoft Windows XP [Version 5.1.2600]

with TCC it would've shown:
TCC  9,02.151   Windows XP [Version 5,1,2600]

which it doesn't, ergo D&DR seems to call it directly, ignoring extensions and comspec.

Regarding captures etc.. You should be able to do exactly the same as you already do.

Below I use %comspec% when referring to where you'd use the returned string from SysUtils.GetEnvironmentVariable('ComSpec').

"%comspec%" /c c:\tmp\test.bat
will with the default paths perform exactly the same as
"c:\windows\system32\cmd.exe" /c c:\tmp\test.bat

and (comspec expanded) "c:\program files\jpsoft\tcmd9\tcc.exe" /c c:\tmp\test.bat
would do the same, but with a expanded batch language etc.

Make note of the quotes..
The comspec variable is not likely to contain quotes, but may contain spaces.

mouser:
I'll see what i can do for next release..

Maybe a nice solution would be an options tab that let you specify pairs of:
EXTENSION PATTERN | PROGRAM USED TO LAUNCH FILE

So:
*.bat | c:\program files\jpsoft\tcmd9\tcc.exe
*.php | c:\program files\languages\php\php.exe"


Note that you could already do that manually by putting the full line in the commandline, this would simply be a way to let you specify things differently for general use and then skip having to put the info on the commandline.

But just to clarify i'm understanding things.. if you manually change your commandline item to start with "c:\program files\jpsoft\tcmd9\tcc.exe" then does it do what you want?  OR are you saying that this issue only comes up when D+DR is auto-creating .bat files and launching them (which happens when D+DR sees a commandline that doesnt start with a .exe).

f0dder:
myarmor: perhaps you haven't fixed all assignments for .bat/.cmd properly? Try using regmon and see what .bat related entries are looked at when you launch a file with D+DR, perhaps it's related to some of the more obscure stuff like the DropHandler GUID entry... ShellExecute() works in mysterious ways :)

Navigation

[0] Message Index

[#] Next page

Go to full version