AppExist( ..., 1 ) meaning and syntax

Started by archimede, October 23, 2023, 03:14:54 AM

Previous topic - Next topic

archimede

Windows 7 x64.
I use
AppExist("Notepad.exe")
It no detects Notepad.exe working.
If I use
AppExist("Notepad.exe",1)
it detects the notepad.exe working: why?
What is the meaning of "Current-session-only"?
Thank you very much.

td

From MSFT docs: "A session consists of all of the processes and other system objects that represent a single user's logon session.  These objects include all windows, desktops and windows stations.  A desktop is a session-specific paged pool area and loads in the kernel memory space.  This area is where session-private GUI objects are allocated from.  A windows station is basically a security boundary to contain desktops and processes.  So, a session may contain more than one Windows Station and each windows station can have multiple desktops."
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

archimede

Interesting.
And then, why if I specify
AppExist("Notepad.exe")
it no works, but if I specify
AppExist("Notepad.exe", 1)
it works?

td

Your system likely has corrupt or disabled performance counters. Check the Tech Database to learn how to fix it.

https://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/Functions+!!~Performance~Monitoring~and~WinBatch~!!.txt

<edit> That article is a bit over the top so start a command prompt window and run the LODCTR /R command which will automagically rebuild your counters.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

archimede

Windows 7 x64.
I used Exctrlst.exe but it show ONLY Outlook performance counters is off: all others are ON.

I used
loadctr /R
and now the AppExist( ... ) function seem work well; Exctrlst.exe shows ONLY Outlook performance counters is off, like before.
Then:
- why Exctrlst.exe tell it is all ok (except Outlook), but using loadctr /R it seem solve the problem?
- I no understood a thing: loadctr /R is BETTER than Exctrlst.exe or not?
- Could be useful execute loadctr /R at every windows start?
Thank you very much

td

Exctrlst.exe is used to enable and disable performance counters on a per-application basis. Lodctr /R recreates counters from a system cache. Enabling/disabling is not the same thing as recreating.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

cssyphus

Archimede - this thread might be useful to you:

Slack no longer winExist-able

- Stan provides a UDF that lets you find a process based on an exe filename.

- Tony provides another example using CLR, plus a few additional tips.