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!
[Cmd] Batch file launched from TC runs slowly
Moderators: Hacker, petermad, Stefan2, white
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!
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!
In your case, tasklist is slow! If you use the one in sysnative it is fast even in system32 cmd file.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!
What you can do in your current batch is to have a first line like
Code: Select all
@set path=c:\windows\sysnative;%path%