Long Wait for TaskList in cmd Window

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
JRL
Automation Wizard
Posts: 3497
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Long Wait for TaskList in cmd Window

Post by JRL » Tue Jan 09, 2018 10:58 pm

I've had a program for many years that I revisited last week. The program took way too long to run so I started investigating today to see why. Found that running TaskList in a Macro Scheduler RunProgram> cmd window is taking up to 3 minutes. Opening a dos window, typing and running the equivalent line takes a second. I turned the following into an executable and ran it on a dozen different computers. The time to run varied but was never less than a minute. One computer took 212 seconds.

Running "tasklist /m > %temp%\modules.txt" in a standard cmd window takes a second. Why the big difference?

Code: Select all

Let>RP_Wait=1
RunProgram>cmd /c tasklist /m > %temp_dir%modules.txt

Timer>vTotal
Let>vTotal={round(%vTotal%/1000)}

MDL>vTotal

User avatar
Djek
Pro Scripter
Posts: 147
Joined: Sat Feb 05, 2005 11:35 pm
Location: Holland
Contact:

Re: Long Wait for TaskList in cmd Window

Post by Djek » Wed Jan 10, 2018 6:21 am

strange,

it has something to do with the /m
If i leave the /m out, it runs fast.

But to come to the original question: no i dont know why ....

kind regards,
Djek

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts