Welcome!

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

SignUp Now!

Not real important but kind of annoying EXIT issue...

May
855
0
As I have mentioned before on this forum, I have poor eyesight and depend on the Windows "Magnify" application to see what I am doing. Because of this, I have a .btm file to start the "magnify" program and then "up" its priority (it is often essentially useless when run at its "normal" priority). Contents of said .btm file (modified slightly to turn echo ON and run from my Z: drive) are below:
Code:
@Echo On
Iff "%1" == "" Then
   Start /Elevated /B /LA /LD /LF /LH /PGM Z:\DoMagnify.btm Elevated
   Quit 0
EndIff
Iff %@PID[Magnify.exe] == 0 Then
   C:\Windows\System32\Magnify.exe
   Delay 1
EndIff
Do While %@PID[Magnify.exe] == 0
   Delay 1
EndDo
PRIORITY %@PID[Magnify.exe] ABOVE
Exit 0
The output that is then displayed is:
Code:
ISO8601 plugin v1.1.1 loaded.
SafeChars plugin v1.4.0 loaded.

TCC  12.10.66   Windows 7 [Version 6.1.7601]
Copyright 2011  Rex Conn & JP Software Inc.  All Rights Reserved
Registered to Daniel Mathews

Iff "%1" == "" Then
Iff %@PID[Magnify.exe] == 0 Then
Do While %@PID[Magnify.exe] == 0
PRIORITY 5232 ABOVE
Exit 0
As might be able to see from the above, the batch file "hangs" at the "Exit" command when run.

So replacing the "Exit" command by a "Quit" command, the batch file runs normally and then quits, leaving the "Started" command window still open (which I obviously don't want). Typing the "Exit" command in that command window then causes that command window to "hang" without actually exiting, just to be clear about it. What is going on here?

And, as it says above, TCC 12.10.66 Windows 7 [Version 6.1.7601]
 
Do you have a TCEXIT file?

Do you see the same issue if you start TCC without any plugins?
 
Do you have a TCEXIT file?

Do you see the same issue if you start TCC without any plugins?
Charles, good guesses but no. I do not have a TCEXIT file (neither that I can remember (and I don't have any idea what I would have put into it), or find), and disabling plugins by temporarily renaming the "plugins" directory (and they then did not load) had no effect.

New Data!!!!! It turns out that the command "Start /Elevated" starts a new TCC session that then "hangs" if "Exit" is typed as the first and only command in that session.
 
From what I see below you have HARD CODED the PID. 5232, I'm sure the
PID will change every time you
start the magnify.exe
The hang maybe because you are trying to up the ante on another process
with that PID

single line no loops no iffs simple one liner batchfile.

priority %@pid[magnify.exe] above

-----Original Message-----
From: mathewsdw

Iff "%1" == "" Then
Iff %@PID[Magnify.exe] == 0 Then
Do While %@PID[Magnify.exe] == 0
PRIORITY 5232 ABOVE
Exit 0
---------
As might be able to see from the above, the batch file "hangs" at the
"Exit" command when run.

So replacing the "Exit" command by a "Quit" command, the batch file runs
normally and then quits, leaving the "Started" command window still open
(which I obviously don't want). Typing the "Exit" command in that
command window then causes that command window to "hang" without
actually exiting, just to be clear about it. What is going on here?

And, as it says above, TCC 12.10.66 Windows 7 [Version 6.1.7601]
 
So replacing the "Exit" command by a "Quit" command, the batch file runs normally and then quits, leaving the "Started" command window still open (which I obviously don't want). Typing the "Exit" command in that command window then causes that command window to "hang" without actually exiting, just to be clear about it. What is going on here?

How are you running the batch file -- from the Windows desktop or Explorer? If so, then the "hang" will be because of your shortcut settings. (Or your .btm file association settings.)
 
From: Kachupp
| From what I see below you have HARD CODED the PID. 5232, I'm sure the
| PID will change every time you
| start the magnify.exe
| The hang maybe because you are trying to up the ante on another
| process
| with that PID
|
| single line no loops no iffs simple one liner batchfile.
|
| priority %@pid[magnify.exe] above

You ignored the original post, which clearly showed the OP's batch file containing the exact command you recommended, and line with the string 5232 as the ECHO of that command!
And yes, the OP's batch file is well thought out and contains no unnecessary loops or IFF-s - they are needed to allow the OS to start the requested program, since its priority can only be changed AFTER it has started to run.
--
Steve
 
From: mathewsdw
| As I have mentioned before on this forum, I have poor eyesight and
| depend on the Windows "Magnify" application to see what I am doing.
| Because of this, I have a .btm file to start the "magnify" program
| and then "up" its priority (it is often essentially useless when run
| at its "normal" priority). Contents of said .btm file (modified
| slightly to turn echo ON and run from my Z: drive) are below:
| Code:
| @Echo On
| Iff "%1" == "" Then
| Start /Elevated /B /LA /LD /LF /LH /PGM Z:\DoMagnify.btm Elevated
| Quit 0
| EndIff
| Iff %@PID[Magnify.exe] == 0 Then
| C:\Windows\System32\Magnify.exe
| Delay 1
| EndIff
| Do While %@PID[Magnify.exe] == 0
| Delay 1
| EndDo
| PRIORITY %@PID[Magnify.exe] ABOVE
| Exit 0

What would happen if from any instance of TCC you issue the command:
 
From: mathewsdw
| As I have mentioned before on this forum, I have poor eyesight and
| depend on the Windows "Magnify" application to see what I am doing.
| Because of this, I have a .btm file to start the "magnify" program
| and then "up" its priority (it is often essentially useless when run
| at its "normal" priority). Contents of said .btm file (modified
| slightly to turn echo ON and run from my Z: drive) are below:
| Code:
| @Echo On
| Iff "%1" == "" Then
| Start /Elevated /B /LA /LD /LF /LH /PGM Z:\DoMagnify.btm Elevated
| Quit 0
| EndIff
| Iff %@PID[Magnify.exe] == 0 Then
| C:\Windows\System32\Magnify.exe
| Delay 1
| EndIff
| Do While %@PID[Magnify.exe] == 0
| Delay 1
| EndDo
| PRIORITY %@PID[Magnify.exe] ABOVE
| Exit 0

What would happen if from any instance of TCC you issue the command:

start /elevated /abovenormal C:\Windows\System32\Magnify.exe

--
Steve
 
From what I see below you have HARD CODED the PID. 5232, I'm sure the
PID will change every time you
start the magnify.exe
The hang maybe because you are trying to up the ante on another process
with that PID

single line no loops no iffs simple one liner batchfile.

priority %@pid[magnify.exe] above

-----Original Message-----
From: mathewsdw

Iff "%1" == "" Then
Iff %@PID[Magnify.exe] == 0 Then
Do While %@PID[Magnify.exe] == 0
PRIORITY 5232 ABOVE
Exit 0
---------
As might be able to see from the above, the batch file "hangs" at the
"Exit" command when run.

So replacing the "Exit" command by a "Quit" command, the batch file runs
normally and then quits, leaving the "Started" command window still open
(which I obviously don't want). Typing the "Exit" command in that
command window then causes that command window to "hang" without
actually exiting, just to be clear about it. What is going on here?

And, as it says above, TCC 12.10.66 Windows 7 [Version 6.1.7601]
I really don't understand your comment about "HARD CODED". I do not, did not and absolutely never would do such a thing. If you look at the above .btm file a little more closely, you will see that the PID is coming from the @PID function.
 
How are you running the batch file -- from the Windows desktop or Explorer? If so, then the "hang" will be because of your shortcut settings. (Or your .btm file association settings.)
Rex, for a long list of reasons related to my disabilities I literally almost never run a batch file or anything else for that matter from the Windows desktop or Explorer; I run everything virtually without exception from a command prompt. (I have aliases or batch files for everything I run on any sort of regular basis; I may use the start menu if it is something I almost never run and therefore didn't make an alias or batch file for, but even then I typically CDD into the directory containing the application and run it from there.) I don't think there's much more to say on this matter...
 
From: mathewsdw
| As I have mentioned before on this forum, I have poor eyesight and
| depend on the Windows "Magnify" application to see what I am doing.
| Because of this, I have a .btm file to start the "magnify" program
| and then "up" its priority (it is often essentially useless when run
| at its "normal" priority). Contents of said .btm file (modified
| slightly to turn echo ON and run from my Z: drive) are below:
| Code:
| @Echo On
| Iff "%1" == "" Then
| Start /Elevated /B /LA /LD /LF /LH /PGM Z:\DoMagnify.btm Elevated
| Quit 0
| EndIff
| Iff %@PID[Magnify.exe] == 0 Then
| C:\Windows\System32\Magnify.exe
| Delay 1
| EndIff
| Do While %@PID[Magnify.exe] == 0
| Delay 1
| EndDo
| PRIORITY %@PID[Magnify.exe] ABOVE
| Exit 0

What would happen if from any instance of TCC you issue the command:

start /elevated /abovenormal C:\Windows\System32\Magnify.exe
--
Steve
Steve, I am laughing as I type this! The batch file in question was written years ago and has been modified/updated as TCC/TCMD have been updated, and I was not aware of the "/AboveNormal" option. That of course allows me to eliminate the batch file altogether and just use an alias, which I just tried and works fine!!! (As I indicated earlier, the problem was not with the batch file itself in any way.) But Rex, there is still an issue with "Start /Elevated" starting a TCC session that "EXIT" does not terminate...
 
I really don't understand your comment about "HARD CODED". I do not, did not and absolutely never would do such a thing. If you look at the above .btm file a little more closely, you will see that the PID is coming from the @PID function.

He's confusing the output of the batch file (ECHO ON) with the batch file itself. An easy mistake to make, I'd say.
 
The .BTM association might still be the issue, if you're using START to launch it.
 
And after looking again, I see your batch file uses START to relaunch itself if it finds it's running without administrative powers....
 
For grins, you might try changing that third line to

Code:
Start /Elevated /B /LA /LD /LF /LH /PGM %_Cmdspec /C Z:\DoMagnify.btm Elevated

and see if that resolves the problem.
 
You need to use the /C option in START if you want it to close the window
when the batch file terminates.

Rex Conn
JP Software
Rex, of course you are correct (could you be anything but?) and in the long-term evolution of the command in question, I never noticed that. But be that as it may, shouldn't an "Exit" command actually exit the session, rather than hang?
 
On Thu, Aug 4, 2011 at 11:18 PM, mathewsdw <> wrote:

> ---Quote (Originally by rconn)---
> You need to use the /C option in START if you want it to close the window
> when the batch file terminates.
> ---End Quote---
> Rex, of course you are correct (could you be anything *but*?) and in the long-term evolution of the command in question, I never noticed that. *But be that as it may, shouldn't an "Exit" command actually exit the session, rather than hang?

Depends on what the exit is exiting *from*. In this case, the exit
will exit from the batch file it's embedded in, but unless you tell
Windows to close the window when the batch file terminates, Windows
will keep it open. That's what the /c command line parm is all about
- it tells Windows to close the window when whatever is running in it
finishes.
______
Dennis
 
5232 < hard coded the pid, which if you got the PID from @pid after many
(testing) instance of running the same app wouldn't of repeated
the same PID, it would be a new instance of the same program running and
a new PID. I've never use magnify it self, if its _able_ to run more
than ONE-1 instance
of it, it would not return the same PID 5232 HARD CODE in your batch
HARD CODED < priority has no option other than to except your PID input,
PID being 5232

[Steve]
-Steve, IF he had started magnify on its own and used priority
%@pid[magnify.exe] above
-it would make the contents of the original batch file superfluous.
-he could start it as a service _and_ .or. a scheduled tasks
-services.msc GroupPolicyEditor what ever its called (pro vers/elite
home users) allows scripts USER todo what EVER they want, onBOOT
-Are you allowed to ignore that in vista/w7 ? - XP buggy as Rexx has
pointed out to Vince allows you to do just that. "MY SYSTEM DO WHAT EVER
I WANT IT TO DO"

do what i mean not what i say "DWIM" ?
I forget the term Rexx uses for that

-----Original Message-----
From: mathewsdw
Subject: RE: [Support-t-3033] Re: Not real important but kind of
annoying EXIT issue...


---Quote (Originally by Kachupp)---
From what I see below you have HARD CODED the PID. 5232, I'm sure the
PID will change every time you
start the magnify.exe
The hang maybe because you are trying to up the ante on another process
with that PID

single line no loops no iffs simple one liner batchfile.

priority %@pid[magnify.exe] above

-----Original Message-----
From: mathewsdw

Iff "%1" == "" Then
Iff %@PID[Magnify.exe] == 0 Then
Do While %@PID[Magnify.exe] == 0
PRIORITY 5232 ABOVE
Exit 0
---------
As might be able to see from the above, the batch file "hangs" at the
"Exit" command when run.

So replacing the "Exit" command by a "Quit" command, the batch file runs
normally and then quits, leaving the "Started" command window still open
(which I obviously don't want). Typing the "Exit" command in that
command window then causes that command window to "hang" without
actually exiting, just to be clear about it. What is going on here?

And, as it says above, TCC 12.10.66 Windows 7 [Version 6.1.7601]
---End Quote---
I really don't understand your comment about "HARD CODED". I *do not*,
*did not* and *absolutely never would* do such a thing. If you look at
the above .btm file a little more closely, you will see that the PID is
coming from the @PID function.
 
On Thu, Aug 4, 2011 at 11:18 PM, mathewsdw <> wrote:
Depends on what the exit is exiting *from*. In this case, the exit
will exit from the batch file it's embedded in, but unless you tell
Windows to close the window when the batch file terminates, Windows
will keep it open. That's what the /c command line parm is all about
- it tells Windows to close the window when whatever is running in it
finishes.
______
Dennis
Not to be a contrarian, Dennis, but that is simply not the case. To quote the help file: "EXIT terminates the current copy of the command processor". And more from the help file: "/B Exit the current batch file, rather than the shell." You are welcome, of course, to look it up in the help file yourself.
 
You need to use the /C option in START if you want it to close the window when the batch file terminates
I am confused. Based on past experience I would expect a START /C that invoked a .BTM file to close the window irrespective of any EXIT command in the batch file, and a START /K (or with neither switch) to leave that window open unless the batch file contained an EXIT. A bout of testing suggests that is exactly how the latest TCC behaves here.


TCC 12.11.73 x64 Windows 7 [Version 6.1.7601]
TCC Build 73 Windows 7 Build 7601 Service Pack 1
 
Back
Top