system
string
system は、取り消し不可能、照会不可能、および編集不可能です。
文字列引数は、シェルで実行するコマンドです。実行したコマンドの出力が文字列として返されます。 system コマンドはシステムに依存するため、Windows と UNIX では結果が異なることに注意してください。 注記: Linux のバックグラウンドでコマンドを実行するには、その出力をリダイレクトする必要があります。例: system("sleep 10 /dev/null 21 "); system("start C:/aw/Maya/bin/fcheck.exe " + $filename); system("C:/aw/Maya/bin/fcheck.exe " + $filename); | string | 実行結果 |
// On Linux
//
system("/usr/bin/date");
// Result: Tue Nov 23 18:12:39 EST 1999
//
// On Windows
//
system("start C:/WINNT/NOTEPAD.EXE" );
$directoryListing = system("DIR");
// Make a sample file to use as a test example
//
$exampleFileName = ( `internalVar -userTmpDir` + "example.txt" );
$fileId=`fopen $exampleFileName "w"`;
fprint $fileId "Hello there\n";
fclose $fileId;
// Use the "load" keyword to open the file with the default app.
// (Windows only)
//
system("load " + $exampleFileName );