This class provides access to various base functions of system platforms. Look in the sys package for more system APIs.

Static methods


Returns all the arguments that were passed in the command line. This does not include the interpreter or the name of the program file.

(java)(eval) On Windows, non-ASCII Unicode arguments will not work correctly.

(cs) Non-ASCII Unicode arguments will not work correctly.

@:has_untypedstaticcommand(cmd:String, ?args:Array<String>):Int

Runs the given command. The command output will be printed to the same output as the current process. The current process will block until the command terminates. The return value is the exit code of the command (usually 0 indicates no error).

Command arguments can be passed in two ways:

  1. Using args to pass command arguments. Each argument will be automatically quoted and shell meta-characters will be escaped if needed. cmd should be an executable name that can be located in the PATH environment variable, or a full path to an executable.

  2. When args is not given or is null, command arguments can be appended to cmd. No automatic quoting/escaping will be performed. cmd should be formatted exactly as it would be when typed at the command line. It can run executables, as well as shell commands that are not executables (e.g. on Windows: dir, cd, echo etc).

Use the API for more complex tasks, such as background processes, or providing input to the command.


Exits the current process with the given exit code.

(macro)(eval) Being invoked in a macro or eval context (e.g. with -x or --run) immediately terminates the compilation process, which also prevents the execution of any --next sections of compilation arguments.


Gets the current working directory (usually the one in which the program was started).


Returns the value of the given environment variable, or null if it doesn't exist.


Prints any value to the standard output.


Prints any value to the standard output, followed by a newline. On Windows, this function outputs a CRLF newline. LF newlines are printed on all other platforms.


Changes the current working directory.

(java) This functionality is not available on Java; calling this function will throw.


Suspends execution for the given length of time (in seconds).


Returns the type of the current system. Possible values are: - "Windows" - "Linux" - "BSD" - "Mac"


Gives the most precise timestamp value available (in seconds).