WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.


Process ID

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Check if a Process is using CPU

 Keywords: Process CPU processing 


In Winbatch 2000 and Windows XP, I have troubles with a program that does not really go out of the memory. Anytime I call it, it opens a new process...

As long as I use the program, it needs CPU-time every so many seconds. So I think I can kill the process if it does not use CPU-time for 5 seconds or so...

Is there any way to check about a process is using CPU-time?


More information on the program and processes started might be helpful. By any chance is the application you are srarting a 16 bit Windows app? When you start a 16-bit program on a computer running Windows NT (4/2000/XP), the Ntvdm.exe and Wowexec.exe processes start. After you quit the 16-bit program, the Ntvdm.exe and Wowexec.exe processes remain in memory.

This behavior is a design feature of Windows NT. The Ntvdm.exe and Wowexec.exe processes remain in memory in case you start another 16-bit program. Leaving the Windows-On-Windows (WOW) environment (which consists of the Ntvdm.exe and Wowexec.exe processes) in memory improves performance.

The WOW environment is not loaded when you start Windows NT. It is loaded when you first start a 16-bit program.

However if you are refering to a 32 bit application, Maybe if the following code fits your needs. It basically monitors a process every second or so, and checks the '% processing time'. It will wait up to the value specified by the timeout variable.

timeout = 5
appname = "PopMenu"
counterstring=StrCat("\Process(", appname,")\%% Processor Time")
BoxOpen( counterstring ,"")
if WinVersion(4)==4; NT
	timer = 0
	intdat = 0
	While timer<=timeout && intdat==0
		if intdat!=0
		   timer = 0
			intdat = 0
	   BoxText(strcat("Timer ",timer,@CRLF,"Int Value: ",intdat))
  Message("tGetData", "Is designed to run on NT")
Message("Done","No real processing occured in the last 5 seconds" )
If this doesn't fit your needs, you might want to look into some of the other 'counters' that are available that you can monitor. For a list of available counters you can launch perfmon.exe on our system.....
Article ID:   W15075
File Created: 2017:07:28:12:58:38
Last Updated: 2013:04:01:08:08:08