He want to start a dos app but dont want to popup/show the DOS-Command windowIf you don't call the MainForm.Show method, the window won't be visible.
Dim WinScriptHost
Set WinScriptHost = CreateObject("WScript.Shell")
WinScriptHost.Run Chr(34) & "mybatch.bat" & Chr(34), 0
Set WinScriptHost = Nothing
copy a.txt b.txt
Private shl As Shell
Dim params As List: params.Initialize
params.Add("/c")
params.Add("start")
params.Add("test.vbs")
shl.Initialize("shl", "cmd.exe", params)
shl.WorkingDirectory = File.DirApp
shl.Run(-1)
Dim sh As Shell
sh.Initialize("Shell", "cmd.exe", Array("/c", "dir"))
sh.Run(1000)
When I call dos commands, I don't get a dos window popping up. For example the "Dir" command (http://ss64.com/nt/dir.html) I call it this way:
B4X:Dim sh As Shell sh.Initialize("Shell", "cmd.exe", Array("/c", "dir")) sh.Run(1000)
Sub RunShellCommand
'ds30LoaderConsole must be in objects folder!
Private shl As Shell
Private params As List
params.Initialize
params.Add("/c")
params.Add("start")
params.Add("ds30LoaderConsole.exe") 'located in File.DirApp
params.Add("-f="&fname) 'fname is the full path of the hex file. TODO change it for File.DirApp
params.Add("-d=pic16f1825") 'device
params.Add("-k=com14") 'COM Port
params.Add("-r=115200") 'Baudrate
params.Add("-p") 'write flash
params.Add("-o") 'non-interactive
shl.Initialize("shl","cmd.exe",params)
shl.WorkingDirectory = File.DirApp
Try
' Run with disabled timeout
shl.Run(-1)
Catch
Log(LastException.Message)
End Try
End Sub