highend wrote:There can be cornercases where > 1 doesn't necessarily mean: really more than a "real" (with a gui) instance of XY
TaskManager seems to return a "(2)" after listing XYplorer and shows Help, FP or other child windows in a sub column, when child windows of XY exists, but Tasklist in a command box seems to only show full GUI instances of XYplorer at least in my quick tests. I did change the comparsion to be ">= 2". Yes, as far as the runret and using CMD, in most attempts I was double quoting "cmd" which as it turns out was not required in this case, but as PeterH's post shows...
PeterH, I ran your suggested line (the first in the code box) and it worked fine, as did highend's (the second line)
Code: Select all
if(gettokenindex("XYplorer.exe*",runret('"cmd" /c "tasklist /nh /FI "Imagename eq XYplorer.exe""'),"<crlf>", "wc") >= 2) {
if(gettokenindex("XYplorer.exe*",runret("cmd /c tasklist /FI ""Imagename eq XYplorer.exe"" /NH"), "<crlf>", "wc") >= 2) {
I was also able to get the other alternative below to work, which was very close to what I was attempting earlier...
Code: Select all
if(gettokenindex("XYplorer.exe*",runret("""cmd"" /c ""tasklist /nh /FI ""Imagename eq XYplorer.exe"""""),"<crlf>", "wc") >= 2) {
So, all 3 of the above work... and I hadn't stumbed on any of them other than the heredoc. Thanks guys.