### Windows Open Command Shell

To open up the DOS Command Shell, the jShell Library is required.
There is a Sub EventName_ProcessCompleted, which can used to trigger actions based upon the result or exitcode.
Define Global Var
Private shl As Shell
Example opening a Windows DOS Command Shell
`Sub runDOSShell
' Evenname, Executable, Arguments
shl.Initialize("shl", "cmd.exe", Array As String("/c", "start"))
'
' Run with disabled timeout
shl.Run(-1)
End Sub`
' another way is to use the parameters as a list
' and in addition set a working directory
`Sub runDOSShell2(paramlist As List)
' Evenname, Executable, Arguments
shl.Initialize("shl", "cmd.exe", paramlist)
' Set the working directory
shl.WorkingDirectory = File.DirApp
' Run with disabled timeout
shl.Run(-1)
End Sub`
' Handle completion of the Shell
`Sub shl_ProcessCompleted (Success As Boolean, ExitCode As Int, StdOut As String, StdErr As String)
Log(Success)
End Sub`
Some further usage examples using above defined Sub runDOSShell2 with a Parameterlist
' List all files and capture output in a file
' The DOS command shell is not opened
runDOSShell2(Array As String("/c", "start","/B", "dir", "*.*", ">a.txt"))
' Open the DOS command shell
' Delete all bak files from the dirapp
runDOSShell2(Array As String("/c", "start", "del", "*.bak"))

Changed: , Category: Shell, File: T6C248M1795.htm, ID: 1795