mmmm espero y te sirv esto je.¡!
a si solo crea un archivo en "c:\test.bat" con contenido que desees por ejemplo este:
dir /w
en un formulario:
1 solo botoncillo
Private Sub Command1_Click()
Dim result As Long, sout As String, cwritten As Long
sout = "hi there" & vbCrLf
result = WriteConsole(hconsole, ByVal sout, Len(sout), cwritten, ByVal 0&)
Shell "c:\test.bat"
End Sub
Private Sub Form_Load()
If AllocConsole() Then
hconsole = GetStdHandle(std_output_handle)
If hconsole = 0 Then MsgBox "couldn't allocate stdout"
Else
MsgBox "couldn't allocate console"
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
CloseHandle hconsole
FreeConsole
End Sub
En un Modulo
Public Declare Function AllocConsole Lib "kernel32.dll" () As Long
Public Declare Function FreeConsole Lib "kernel32.dll" () As Long
Public Declare Function CloseHandle Lib "kernel32.dll" (ByVal hObject As Long) As Long
Public Declare Function GetStdHandle Lib "kernel32.dll" (ByVal nStdHandle As Long) As Long
Public Declare Function WriteConsole Lib "kernel32.dll" Alias "WriteConsoleA" (ByVal hConsoleOutput As Long, ByRef lpBuffer As Any, ByVal nNumberOfCharsToWrite As Long, ByRef lpNumberOfCharsWritten As Long, ByRef lpReserved As Any) As Long
Public Const std_output_handle = -11&