Arlen,
> What I had meant was that the actual file being executed didn't
> have to be a batch file. It could be any "executable" file
I already guessed that that might have been the idea behind what you said,
but the way you said it could be explained as *any* extension ("executable"
or not) would be acceptable. And we both know that that won't work. :-)
> Perhaps I could have said "Create an executable file" or just
> "Create a file", since the file doesn't even need to be executable.
You're making the same mistake here: The file really needs to be of a type
that is, in this case, recognised either as a true executable, or linked to
one of the several scripting engines your OS has available.
In other words: the extension needs to be from a (very) small subset of
possible ones.
> As another example, I just created this system-wide "bookmark" command:
Yes, that works too. Because the ".htm" extension is linked to a program
(the browser). Pick an extension that is not a program or linked to one,
and you will get a "don't know how to handle that" error message. :-)
> I guess what you're saying is that once you decided on a name, you have
> to actually use *that* name in the App Paths key, which is true.
Not quite. I meant to say that when you indicate you can use any name that
you should explain (of sorts) why you are using a specific one. Even if its
just a short "For my example I've choosen to use the name {whatever}" one.
> Particularly for noobs who may not have their filename extension
> viewing turned on by default.
Yes, particulary there.
> It should be noted that I store my "data" files in a public/private
> data hierarchy
:-) That would have been a good "I suggest ..." addition to your tut.
Currently the poor noob has no idea where to store such files (and why), and
could easily choose an existing folder or create a bunch in the root of C: -
which could cause problems (and is ugly) ...
And as long as you are talking about a users own place to store such files,
XP offers place for such a folder under the "C:\Documents and
Settings\{username}" (as available in the %USERPROFILE% environment
variable) branch.
> Had I chosen explicit paths, people would have complained about
> the paths.
True, and most likely I would too. :-)
The point is that *you* do not make a choice, but instead you provide a set
of possible options (does not even need to be exhaustive!) and make
suggestions to what you think would be a good one - and explain why
ofcourse.
> Based on the separate input from you about "phone" being thought \
> of as a verb, a good name for the command could possibly be "lookup";
Thats looks like a good one, but does not indicate exctly what it will be
"looking up".
I think I would go for something like "PhoneNumber" or just "PhoneList".
Much more indicative. But again, offer it as a suggestion.
And by the way, have you ever thought to include a "how to use this program"
output when no (or possibly the "/?") argument is provided ? Would be
both helpful for a first-time user, as well as a reminder for a long-time
(but not all that frequent) user.
> Luckily, in this case, there is no "exe" file.
And pray tell, how do you know that ? Your batch file is supposed to work
on *other peoples* computers, about which you should not make assumptions
like that.
Also, its not only the exe extension which could cause problems. *Any*
extenson which is either directly executable or links to a program that will
handle it could cause the same problems. And FYI, my rather default XPsp3
installation has got a "phone.inf" file in the windows folder tree - with an
"install" verb shown in the rightclick context menu (as in: could muck up
your computer but good). Luckily not in the searchpath, but still ...
> The "phone.exe" in the example is merely the name of a registry key.
I know. But as mentioned above, do the noobs know that too ?
If I would have written such a suggestion in the/my full defensive mode I
would have suggested to pick a name that does not already exist - by either
first searching for it, or just, before using it, typing the name in the
"run" box (a bit dangerous, but if no error pops up it must already be in
use - as an external program *or* "internal" command. Maybe even already
specified in another "App path" entry).
>> Have you ever thought of just placing the .BAT command in a folder
>> named in the search path ? Way easier. :-)
>
> Way easier?
> Not really.
Yes, really.
Your whole "step #3" (mucking around with the registry) can be skipped when
you put the batchfile into the C:\Windows directory, or any of the other
paths named in the %PATH% environment variable.
I would not directly advice it (as my suggestion below it already
indicated), but it is definitily easier.
> The advantage of the App Paths method is that the command doesn't
> pollute your $PATH
Adding a single folder (as in: *once*) to that %PATH% (where all such and
similar stuff can be stored) constitutes to pollution ? I learn something
new every day. :-D
And by the way: I've "polluted" mine over a decade that way (or two. Can't
remember), and I have not seen it (try to) procreate. Its precence in that
path variable also acts as a quick reminder where I should put/store further
enhancements (so they do not get put into a gazillion different folders all
over the drive(s) )
> The advantage of the method you suggest is that you don't need
> to create an App Paths key.
I think you mean here that "you don't need to pollute the App Paths branch".
(hint: All monks of the same order should have to wear the same habit).
The third advantage of using a folder is that its easier to manage:
Deleting a program/script there means its gone. No extra registry-editing
cleanup stuff needed.
The next advantage is that the actual program can be easily be found back,
which you cannot do when using your renaming trick using the App Path ...
>>> the ".exe" extension is simply a mandatory requirement of the
>>> "App Paths" key.
>>
>> Actually ? It isn't.
>
> Teach me (and us) something.
Well, why don't you try it yourself ? Create, for example, the entry
"foobar.blurb" {1} and make it point to your "phone.bat". Than go to your
"run" textfield, and enter the name just like that but *including* that
extension, and press enter (or click OK). What happens ?
{1} See what I did there ? The used filename, but in this case
specifically the extension (as that is what we are talking about) is an
*example*. It indicates that there might well be more doing behaving the
same.
And by the way, including the extension of an executable, batch or other
scripting forces the OS not to apply its own precedence rules (read: have it
guess what the extension is supposed to be), and allows you to purposely
execute, in a console window, a {name}.bat when a {name}.exe also exists in
the same folder.
> Does anyone reading this have a *different* last four characters in
> *any* entry in the "App Paths" section of the system registry?
That was not the point.
You where making the mistake of regarding not seeing the presence of
something as it being not allowed. And you where as cocky as to put it
forward as it being a rule. Without actually checking it. :-(
That is how disinformation comes to be. Often by basically well-meaning
people (you) making unbased assumptions and than presenting them as facts to
others. Which, when especially when they are the noobs you are targetting
(read, not knowing how/ready yet to verify such claims) are likely to
propagate them.
> If you have a working example that does *not* end with ".exe", that
> would be very interesting indeed.
See above.
> Huh?
> Nobody said anything about a "grep.exe" file existing.
Damn! You're right! You just named the batchfile "grep", but used the
program "find" in it. My apologies.
But my excuse for that is .... Nah, no excuses. I misread, and thats
fully on my own head.
> HINT: That's why MSoft invented the "App Paths" key in the first place.
Hint: you could already to that in the DOS days by, in some folder that is
part of the searchpath, creating a batch file "linking" to the target
executable, and when Windows came to be by replacing the batchfile with a
.LNK one.
I have absolutily no idea what the "App paths" offers that either of the
above two do not. Do you ?
> My goal is simple which is
> a) Ask a question
> b. Get help on that question
> c. Summarize the results for the benefit of the tribal archives
In that case, make sure to mention that what you post are *not* tutorials or
step plans to be used by anyone, but just your personal experiences while
dabbing into something new (and showing it).
Currently your "benefit of the tribal archives" is to poisson it with
half-truths and full guesses (as shown in the above), which do not help
anyone, least of all the poor noob which thinks you are experienced and know
what you are talking about.
>> But please, make sure that what you offer is actually correct.
>
> A clarification and a correction are two different things.
I was not talking about either of them.
> You mentioned, for example, that a 'grep.exe' is problematic,
> where I clarified that there is no file named 'grep.exe' that was
> proposed.
The problem with that is that while it is true for *your* machine, it does
not need to be for any of the machines reading your message (mine does have
it. Probably came with an installation of (a commandline version of) C or
C++ ).
What I *tried* to tell you is to start thinking defensively. Think beyond
your own and try to take your audiences computers into consideration too.
If you do not than you are in fact writing for an audience of one: You.
> That you were confused doesn't make it an error on anyone
> elses' part. It just means you wish the ad-hoc Usenet post
> covered more detail.
Nope, neither. It was just me recognising the problem it could (and
probably would) create as soon as I put my eyes on it, and trying to make
you aware of it.
And strange though: Seeing that you *know* about grep being a program, you
still thought it would be a good idea to create a batch file with the same
name, regardless of the possiblility of a clash ...
And no, more detail is in no way a good replacement to a bit of common sense
in filenaming.
> To cover all possible areas of confusion is noble
Lol. Thats exactly the very opposite of what you have been doing, and not
at all what I tried to say.
Just start with *not* suggesting (by omission) that what you write down is
the only possible area. Make the reader / your audience aware that there
are others, even if you do not (even) explicitily name them. They are not
dumb, they will be able to respond with a request for more info, or maybe
even just searching google.
> Also, the fact you would rather pollute the $PATH is not an error -
> it's just a different way of accomplishing a similar task.
You keep using that "pollute" word. Are you purposely trying to vilify my
suggested method ? Why ?
And thats apart from me having indicated that neither your App Path method,
nor my suggested addition of a single entry(!) to the searchpath method is
even needed ...
In short, you are comparing two complex methods, while ignoring a much
simpler one. :-o :-(
> If someone tries the steps, and if they don't work for them, I think
> they can be man enough to simply ask what they did wrong.
The problem is, *they* just followed what you posted to the letter, and did
nothing wrong. Its *your* information which contains the errors,
half-truths and full guesswork - all presented as archive-worthy material.
And thats exactly the other problem: what happens when those people find
your posts in those "tribal archives", long (or short) after you moved on ?
Yes, than it will be the thanwhile smartasses in this group who have to
clean up your mess.
And pardon me, the *others* need to man up, confess they did something wrong
and and ask ? Even when all they did was to follow your "this is how I did
it" (even if you have never presented it as such) to the letter ? Where
is *your* responsibility in it ?
>> P.p.s
>> Put the grep executable "data.txt" file into the same folder as
>> the batchfile, and, in that batch file, refer to them like this:
>> %0\..\grep.exe
>> %0\..\data.txt
>> Just remember *not* to name the batch file "grep.bat". :-)
>
> There are plenty of ways to skin a cat.
> The proposed method answers the proposed question.
Wrong answer.
What I showed you there is, as mentioned, an approach to do away with having
to change change paths at different locations (and in this case, in a
script) just to get something, after moving it, working again. It could
even cause your batch script(s) to become copy-paste-and-work, instead of
having to edit them too.
In short, I thought you would see the benefits of it. I guess I was wrong.
Hey, nice talking to you. I'm going to do something else now.
Regards,
Rudy Wieser