Core Function RunShell

From Sputnik Wiki
Jump to: navigation, search
RunShell( <file>, <arguments>, <workdir>, <flag>, <show options> )

Contents

Description

Runs an external program (Using ShellExecute).

Parameters

file

The name of the executable (EXE, BAT, COM, or PIF) to run.

arguments

Optional; The arguments to use.

workdir

Optional; The working directory.

flag

Optional; The "show" flag of the executed program:

@SW_HIDE = Hidden window
@SW_MINIMIZE = Minimized window
@SW_MAXIMIZE = Maximized window

Default runs the program normally.

show options

Optional; Options how to executed program will run:

0 = Run within the current process so that anything printed to console by the run program appears directly on ours.
1 = Run the program within its own window and dont share our console.

Default 0.

Return Value

Success: The PID of the process that was launched.

Failure: 0.

Remarks

A benefit of using ShellExecute is more programs will work without an absolute path etc.

After running the requested program the script continues. To pause execution of the script until the spawned program has finished use the RunShellWait function instead.

Example

RunShell("Notepad.exe", "", @SW_MAXIMIZE);
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox