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

<< < (5/5)

myarmor:
third and final question -- is there any value in letting the user manually specify the command shell to use when launching .bat files instead of checking %comspec%.  this would be useful for people who want to use an alternate shell not configured through %comspec%
-mouser
--- End quote ---
Probably the most failsafe method of doing it, and definitely the easiest.

EDIT: I just checked the (32-bit) version of kernel32.dll from my XP64 system, and indeed CreateProcess has hardcoded checks for .bat and .cmd, and hardcodes "cmd /c".
-f0dder (June 06, 2008, 11:58 PM)
--- End quote ---
Yes it might be..

Hmm, the most straightforward would be to just ignore this..
Sometimes I'm surprised how a straight forward minor change can be talked into being a big big thing..  :)

f0dder:
myarmor: smartest thing would be adding some specific rules for .bat/.cmd and let you specify the app+commandline to use. This could probably be written as some fancy regex thing that could be used for other things as well...

And yeah, this did turn out somewhat convoluted, from what could have been a relatively simple issue - turned out the underlying mechanics are "somewhat fuzzy" though :)

myarmor:
myarmor: smartest thing would be adding some specific rules for .bat/.cmd and let you specify the app+commandline to use. This could probably be written as some fancy regex thing that could be used for other things as well...

And yeah, this did turn out somewhat convoluted, from what could have been a relatively simple issue - turned out the underlying mechanics are "somewhat fuzzy" though :)
-f0dder (June 09, 2008, 06:19 PM)
--- End quote ---
Yes, it might just work.
However, you could turn this into a generally useful thing, as those environment variables could be somewhat useful to access on the D+DR commandline somehow..

I suggested this as an alternative earlier on in this thread as this opens up the comspec for those that wants it, but it also opens up every single environment variable globally defined, such as homedrive,homedir,systemroot, or whatever..

This functionality could make it possible to use the exact same .Ddr for different users, making it possible to unrar files into subfolders of the current users Download folder for instance.
And you could send the same file to a friend and he could use it without changes (at least as long as the same language is used).

Regarding the initial comspec implementation itself, I've implemented the suggested behaviour a couple of times myself for some custom utilities without any issues..
Usually it's more or less straight forward except detecting .bat and .cmd files, then executing it with the contents of the comspec variable, and prepending "/c " before the commandline itself.

f0dder:
Yes, accessing environment variables from D+DR could be useful enough - I just wonder whether all (or "all the important", anyway) shells interpret "/c" the same way? Also, what if you have your %ComSpec% set to an "alien" shell that doesn't support the .bat file syntax? (ie., bash)? There's lots of issues to consider :)

By the way, it seems like ShellExecute does honor the batfile/cmdfile registry entries, but don't care about %ComSpect% at all. But with ShellExecute, you don't get to redirect stdin/stdout...

myarmor:
Yes, accessing environment variables from D+DR could be useful enough - I just wonder whether all (or "all the important", anyway) shells interpret "/c" the same way? Also, what if you have your %ComSpec% set to an "alien" shell that doesn't support the .bat file syntax? (ie., bash)? There's lots of issues to consider :)

By the way, it seems like ShellExecute does honor the batfile/cmdfile registry entries, but don't care about %ComSpect% at all. But with ShellExecute, you don't get to redirect stdin/stdout...
-f0dder (June 09, 2008, 09:36 PM)
--- End quote ---
Comspec is usually a pointer to cmd.exe, so it is implicitly expected that all shells entered there should be externally compatible (parameters) with cmd.

With the availability of environment variables on the D+DR this would be mute as no extra handling would be needed for comspec.

Navigation

[0] Message Index

[*] Previous page

Go to full version