Files
bitburner-src/markdown/bitburner.ns.getrunningscript.md
Michael Ficocelli 6073964768 DARKNET: Darkweb Expansion Project & Bitnode (#2139)
This is BN15. It is a really big change; see the PR for all the details.
2026-02-03 03:40:36 -08:00

1.8 KiB

Home > bitburner > NS > getRunningScript

NS.getRunningScript() method

Get general info about a running script.

Signature:

getRunningScript(filename?: FilenameOrPID, host?: string, ...args: ScriptArg[]): RunningScript | null;

Parameters

Parameter

Type

Description

filename

FilenameOrPID

(Optional) Optional. Filename or PID of the script.

host

string

(Optional) Hostname/IP of target server. Optional, defaults to the server the calling script is running on.

args

ScriptArg[]

Arguments to specify/identify the script. Optional, when looking for scripts run without arguments.

Returns:

RunningScript | null

The info about the running script if found, and null otherwise.

Remarks

RAM cost: 0.3 GB

Running with no args returns current script. If you use a PID as the first parameter, the host and args parameters are unnecessary. If host is omitted while filename is used as the first parameter, host defaults to the server the calling script is running on. Remember that a script is semi-uniquely identified by both its name and its arguments. (You can run multiple copies of scripts with the same arguments, but for the purposes of functions like this that check based on filename, the filename plus arguments forms the key.)