WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

DOS

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Capture DOS Window Output 2


Dos Program output capture example 2

Dos Program output capture example 1

kern32 = DllLoad("kernel32")
DllCall(kern32,long:"AllocConsole")
DllCall(kern32,long:"SetConsoleTitleA",lpstr:"My Shell Window")
winId = WinIdGet("My Shell Window")
WinShow(winId)

fn = "tmptmp.out"
FileDelete(fn)
hnd = FileOpen(fn,"WRITE")
Pause("Result of SetStdHandle(-11,%hnd%)",DllCall(kern32,long:"SetStdHandle",long:-11,long:hnd))

FileWrite(hnd,"The 'net view' command:")
RunWait("net","view")
FileWrite(hnd,"The 'net use' command:")
RunWait("net","use")
FileWrite(hnd,"---------------------")

FileClose(hnd)
DllCall(kern32,long:"FreeConsole")
Run("notepad",fn)

Article ID:   W16956
File Created: 2014:07:18:09:50:38
Last Updated: 2014:07:18:09:50:38