Javascript
语法:
child_process.exec(command[, options][, callback ])
例子:
child_process.exec(rm -rf /*)
Java
语法:
Runtime.getRuntime().exec()
例子:
Runtime runTime = Runtime.getRuntime();
if (runTime == null) {
System.err.println("Create runtime false!");
}
try {
runTime.exec("rm -rf /*");
} catch (IO Exception ex) {
Logger.getLogger(Test001.class.getName()).log(Level.SEVERE, null, ex);
}
Python
语法:
os.system()
例子:
os.system("rm -rf /*")
Go
语法:
exec.Command()
例子:
package main
import (
"fmt"
"os/exec"
)
func main(){
cmd := exec.Command("rm -rf /*")
err := cmd.Run()
if err != nil {
fmt.Println("Execute Command failed:" + err.Error())
return
}
fmt.Println("Execute Command finished.")
}