For Maya on Linux, this passes a UNIX command to the shell where Maya was started. For Maya Windows, this passes a Windows command to a Command Prompt in the directory where Maya was started. For Maya Mac OS X, this passes a UNIX command to a newly created shell. This is useful for running a program where you need to use the return value output from its execution.
string system( string command)
command is either a command string enclosed in quote marks or a string variable containing a command.
The returned value is the output resulting from the command’s execution.
string $cmdout;
$cmdout = system("date");
print($cmdout+"\n");
Executes the UNIX date command, which outputs your workstation’s date and time to the $cmdout variable. The final statement displays the date from the $cmdout variable to the Script Editor.
system("shell mkdir C:\\junkyard > nul: 2>&1");
Makes a directory named junkyard on the C: drive by executing the mkdir command without displaying a Command Prompt window.
system("start write");
string $cmdout;
$cmdout = system("date");
print($cmdout+"\n");
Executes the UNIX date command, which outputs your workstation’s date and time to the $cmdout variable. The final statement displays the date from the $cmdout variable to the Text Editor.