help stataid v. 1.0 - January 2019

Title

stataid - Obtaining and displaying information about running Stata instances under
Microsoft Windows.
stataid can close Stata instances using a Windows process id.

Contents

Syntax

Description

Options

Stored Values

Examples

About

Syntax

To obtain infomation about running Stata instances:

stataid list , [exename(string) list mata ]

To close a running Stata instance using a Windows process id:

stataid kill, id(idnumber)

Options

exename(string) Name of Stata executable.
stataid tries to determine the name of the executable, but might fail
in case the executable has a non standard name.

mata Saves the data in a mata matrix called stataid.

kill(idnumber) Kills process with specific id number.

Description

stataid obtains information about all running Stata processes of a
Microsoft Windows system.
It retrieves the running tasks using shell and tasklist
of the command line.
The following information are saved:

1. Name of the exe file (image name)
2. Process id
3. The name of the session
4. The number of the session
5. Memory used
6. The status
7. The username
8. CPU time
9. Windowtitle

stataid can close any Stata instance, including the running one.
Using the parameter kill, it closes the Stata instance defined by id().
Internally stataid uses the Windows command line command
taskkil to kill the Stata instance.
Note, Stata is closed without saving any data!

Stored Values

stataid stores the following in r():

Scalars

r(instances) Number of Stata instances (only with stataid list).

Examples

To retrieve a list of all current running Stata instances (2 are running and list the result):

stataid list

The output will be:

. stataid list
Obtaining number of Stata instances running under StataSE-64.exe.
2 Stata instance(s) running.

Kill Stata instance with id 13424:

. stataid kill , id(13424)
CPU process id 13424 going to be closed.

Author

Jan Ditzen (Heriot-Watt University)

Email: j.ditzen@hw.ac.uk

Web: www.jan.ditzen.net

Github: https://janditzen.github.io/stataid/

Changelog

This version: 1.0