[Cmd] Batch file launched from TC runs slowly

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
User avatar
TrueY
Junior Member
Junior Member
Posts: 6
Joined: 2014-08-08, 08:59 UTC
Contact:

[Cmd] Batch file launched from TC runs slowly

Post by *TrueY »

Hi,

I have written a small batch file which uses tasklist.exe to look for some running programs on my PC. I realized that this tasklist sometimes runs very slowly, but only if it is launched from TC.

This happens if I dbl-click on the batch file in TC, if I start from a console started from "Open command prompt window" menu or even from the TC's command line (bellow the file list windows).

Started from TC
> tasklist /NH /FI "IMAGENAME eq svchost.exe
returns almost immediately

> tasklist /NH /FI "MODULES eq cygwin1.dll"
runs for 20-25 sec(!)

If I start a cmd from Windows Start menu and start these commands from it they returns almost immediately.

Can I modify some settings to solve this issue?

I use TC 7.55 32 bit on a 64 bit Windows 7.

Thanks in advance!
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Perhaps it is so because you start 64-bit CMD from start menu and 32-bit one from TC (because TC is 32-bit). Try to start C:\Windows\SysNative\cmd.exe and do your test - this will open 64-bit console from TC.
User avatar
TrueY
Junior Member
Junior Member
Posts: 6
Joined: 2014-08-08, 08:59 UTC
Contact:

Post by *TrueY »

Wow! Your idea is great!

In Windows' Start menu I launched c:\windows\SysWOW64\cmd.exe and in that prompt I entered tasklist /NH /FI "MODULES eq cygwin1.dll" and it is sloooow.

Then I started c:\windows\System32\cmd.exe from TC's command prompt and tasklist is still slooow.

I searched for all cmd.exe files under my C:\windows and I found two more of them:

c:\Windows\winsxs\amd64_microsoft-windows-commandprompt_31bf3856ad364e35_6.1.7601.17514_none_e932cc2c30fc13b0\cmd.exe
and the other is
c:\Windows\winsxs\wow64_microsoft-windows-commandprompt_31bf3856ad364e35_6.1.7601.17514_none_f387767e655cd5ab\cmd.exe

If I launch the amd64* version (first one) then is become fast!!! Great! Thanks!

Is there a way to launch the a predefined cmd from TC? Or I have to modify all my scripts which calls the slow tool to be called as %cmd% /C tasklist...?

Many thanks!
User avatar
nsp
Power Member
Power Member
Posts: 1954
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Post by *nsp »

TrueY wrote:Wow! Your idea is great!
Is there a way to launch the a predefined cmd from TC? Or I have to modify all my scripts which calls the slow tool to be called as %cmd% /C tasklist...?

Many thanks!
In your case, tasklist is slow! If you use the one in sysnative it is fast even in system32 cmd file.
What you can do in your current batch is to have a first line like

Code: Select all

@set path=c:\windows\sysnative;%path%
and all should run as fast as you wish !!!
User avatar
TrueY
Junior Member
Junior Member
Posts: 6
Joined: 2014-08-08, 08:59 UTC
Contact:

Post by *TrueY »

I did as you suggested and it did solve the problem!

Many thanks!
Post Reply