Welcome!

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

SignUp Now!

Starting Windows GUI programs from the command line...

May
855
0
Frankly, this is a question that is basically more just out of curiosity than a real problem because it's got an easy workaround, but I'd still like to know why the workaround is (sometimes!) needed.

The situation is quite simple: the following command: C:\Windows\System32\notepad.exe (which is really in an alias named NP but it's the same if run directly from the command line) causes the TCC session from which I start Notepad to "hang" until Notepad is closed. This doesn't happen all that often, but once it starts to happen it's completely consistent: every time I start Notepad from any TCC session that particular TCC session completely hangs (i.e. the command prompt doesn't happen and no commands can be issued/executed) until I close that instance of Notepad; and this is the case for every TCC session from which I start Notepad until Windows is rebooted.

And, yes, I know that if I execute the simple "enhancement" to the command "Start C:\Windows\System32\notepad.exe" that doesn't happen (frankly I and pretty much everyone else I figure would be shocked if it did), but it's a rather deep-down preference of mine to not do things that shouldn't have to be done, and this shouldn't have to be done.

- Dan

P. S. I've actually got an alias "FixNP=Alias NP=Start C:\Windows\System32\Notepad" to fix the Notepad issue if and when it occurs.:)
 
Type OPTION and press Enter, then select the "Startup" tab and check the option "Wait for External Apps." Is it checked? If so, turn that puppy off....
 
Although this doesn't answer your question, it does fall into the category of, "doctor it hurts when I do that. So don't do that then."

Make your NP alias always launch notepad via START. Since it's an alias, you won't care that it's doing a magic dance under the covers. You type NP and like magic, notepad runs and you get your prompt back. You won't ever need to run FixNP.

Assuming that Charles' suggestion doesn't lead to anything, you should see if typing NOTEPAD at a CMD prompt exhibits the same behavior. If Charles hit the nail on the head, then in the words of Emily Letella, "never mind."
 
Guys, thank you for your responses. And Charles, "Wait for External Apps" is not checked, and I would have been, again, frankly shocked because it is only Notepad that exhibits this behavior, it's not true for MS Word, Excel, Firefox, Internet Explorer, Opera, the "Magnify" app (which I am totally dependent upon), this Visual C++ compiler (which I'm trying to avoid using), all of the programs that I wrote myself (in C++ or Visual Basic), and pretty much anything else you can think of. (As I'm sure I've mentioned in the past, I basically don't use the Windows GUI at all because of my vision issues. Thank God (and Rex!:)) for TCC, I probably literally could not live without it.

And Scott, trying to run it from cmd.exe was a very good idea! And it had never occurred to me to even try it. (I really don't use cmd.exd) So I tried it there and cmd.exe does not hang.

Again, not a major problem because it's got an easy workaround; but very weird!!

- Dan

P. S. Just as an unrelated aside, I can't preview my postings at the moment because Firefox just "hangs" (although the "back" button works OK, thankfully). Because of my blindness, bad memory previewing is quite important to me so if there are stupid mistakes I apologize in advance.
 
And BTW, Scott, the reason I don't want to use the "Start" command is that it is my understanding starts a new (hidden) TCC session from which to run the GUI program. Since the TCC instance (now the new, hidden one) doesn't terminate after Notepad starts, it's sitting around taking up memory. And not taking up memory is very important to me; while this is a 32-bit processor with almost 4GB of RAM, since I tend to run a lot of apps concurrently - I've got a total of 17 apps running as of this minute, and that doesn't include the 5 TCC sessions running in my Take Command instance at the moment), running out of RAM causing the processor to do paging is very slow on this machine, presumably because of the pathetically slow disk drive. And if you wonder why I have that many apps (and TCC instances) running at one time, the reason(s) are very simple - my bad memory and glacial slowness as a result of same. If the app (or TCC instance) remains open, I actually remember what I was working on at any given time (be activating the app or TCC session and looking at it) and can rather quickly figure out where I left off. These are needs that the "typical" user probably doesn't have.

- Dan
 
Dan:
If the START command is provided with sufficient information to locate NOTEPAD.EXE, it does not use a hidden instance of TCC to run NOTEPAD. This is the same information that is needed for starting NOTEPAD from the command line without the START command. So the alias suggested by Scott would not use more system resources.
As to your test running NOTEPAD from CMD, since you stated that not all instances of NOTEPAD run from the TCC command line cause TCC to wait, you need to try it from CMD multiple times, too! Is that what you did?
 
And BTW, Scott, the reason I don't want to use the "Start" command is that it is my understanding starts a new (hidden) TCC session from which to run the GUI program.

That is never the case. You can force START to run TCC to run a GUI app, but (1) the TCC session will not be hidden, and (2) it's pointless because START can start an executable directly. The only time you need to start a TCC session first is if you are piping output (not the case with a GUI app), or you enter an alias or variable name that TCC has to expand first.
 
Thank you for the clarification, Rex. That means that my (habitual) concern was misplaced. As far as your comment goes re cmd.exe, that really wouldn't be a practical thing to do (which I didn't even think of, but that's no shock) because this is something that happens very rarely in TCC, literally weeks can go by without it happening at all (although, as I indicated, when it does start happening the only "cure" is to reboot Windows), although I will note that the fact that it was happening in TCC, for whatever reason(s), did not cause it to happen in cmd.exe. I'll fix the alias to put the "Start" into it (and most of my other aliases, too, while I'm at it).

And just to be clear about something, I was under the impression that "Start" started a TCC session that immediately terminated for GUI apps that didn't need TCC, whereas that TCC session "stuck around" for those things that required TCC to run (such as a .btm file, of course), but since I'd done that so seldom (as in probably never), I had never noticed that a visible TCC session is started in those situations.

And that brings me to some very basic questions (not to be taken in any way as complaints or criticism but which were the whole basis for my mis-impression in the first place): exactly what is the reason for the very existence of the "Start" command in the first place? It's clearly not needed for GUI programs (at least in the general case) which is indicated by the simple fact that I start all of my GUI apps from the command line without explicitly using "Start". I suppose it would be useful to run program that read from one file and write to another without any human interaction at all; but are those kinds of programs really that common? And in exactly what way are the "different" from GUI programs if they don't need a console? And would the "Start" command even do the job if they did need a console? (How would the start command even "know" that ahead of time?)_ Although when I look at the docs closely, it does offer a lot of options (none of which I've ever needed), but some of the options, at least, seem to at least imply that a TCC session (of some kind) is started. And this is reinforced (for me) by the fact that "Title" has no effect whatsoever (not really a surprise) for GUI apps; and I've really never run a non-GUI app any other way than from an (active) console.
 
It is useful for starting console apps in their own window. E.g., I have an alias "tcc" with the following value: start /pgm "C:\Program Files\JPSoft\TCmd13\TCC.exe". And, the various start options can be useful for starting both console and gui apps. E.g., I've used the priority and the INV options. And, I sometimes find it useful in btm files. In btm files, TCC always waits for the app to finish if you don't use start.
 
Dave, while I certainly don't disagree, because of the memory limitations of this machine that's something I would virtually never want to do. And I just sent an e-mail to a friend before checking here for any alerts (which is how I saw that you had entered this response) about how I had just Alt-Tabbed to Firefox and it took 47 seconds (since I was expecting this, I formally timed it with stopwatch on my cell phone) for it to come up, and the disk drive light was solidly on the whole time indicating it was pretty clearly a memory-swap operation. For this reason I absolutely do not want to use any virtual memory I don't have to use. (And because of my financial limitations due to my limited income due to my disabilities, I absolutely can not afford to buy a decent machine, which was the primary subject of the e-mail I just sent to my friend.) That's why I was trying to avoid using the "Start" command at all in the first place.

- Dan
 

Similar threads

Back
Top