WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: archimede on October 23, 2023, 03:14:54 AM

Title: AppExist( ..., 1 ) meaning and syntax
Post by: archimede on October 23, 2023, 03:14:54 AM
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.
Title: Re: AppExist( ..., 1 ) meaning and syntax
Post by: td on October 23, 2023, 08:37:46 AM
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."
Title: Re: AppExist( ..., 1 ) meaning and syntax
Post by: archimede on October 23, 2023, 09:21:02 AM
Interesting.
And then, why if I specify
AppExist("Notepad.exe")
it no works, but if I specify
AppExist("Notepad.exe", 1)
it works?
Title: Re: AppExist( ..., 1 ) meaning and syntax
Post by: td on October 23, 2023, 01:44:16 PM
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 (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.
Title: Re: AppExist( ..., 1 ) meaning and syntax
Post by: archimede on October 24, 2023, 12:58:45 AM
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
Title: Re: AppExist( ..., 1 ) meaning and syntax
Post by: td on October 24, 2023, 07:04:34 AM
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.
Title: Re: AppExist( ..., 1 ) meaning and syntax
Post by: cssyphus on April 07, 2024, 07:11:24 AM
Archimede - this thread might be useful to you:

Slack no longer winExist-able (https://forum.winbatch.com/index.php?topic=3043.0)

- 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.