Skip to content

Instantly share code, notes, and snippets.

@xcriptus
Created December 9, 2012 20:40
Show Gist options
  • Save xcriptus/4246883 to your computer and use it in GitHub Desktop.
Save xcriptus/4246883 to your computer and use it in GitHub Desktop.
StarUML - Shell Execution
// Execution through Shell.Application
var shell = new ActiveXObject("Shell.Application") ;
shell.ShellExecute("cmd arg1 arg2 ...")
//--- Execution through WScript
var shell = new ActiveXObject("WScript.Shell");
// Execute the command
ws.run( "notepad.exe foo.txt") ;
// Execute and wait for the output and errors
var cmd = "myCommand arg1 arg2 arg3" ;
var errcode = shell.Run("%comspec% /c "+cmd+" 1>"+outfile+" 2>"+errfile,0,true) ;
//--- Getting the parameters of command line when called from wscript
// WScript thisscript.js arg0 arg1 arg2
var shell = new ActiveXObject("WScript.Shell");
var nbargs=WScript.Arguments.Length ;
var arg1=WScript.Arguments.Item(0) ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment