Ver Mensaje Individual
  #4 (permalink)  
Antiguo 05/10/2008, 12:40
abdiel2475
 
Fecha de Ingreso: julio-2008
Mensajes: 22
Antigüedad: 15 años, 10 meses
Puntos: 0
Respuesta: ejecutar batch con visual basic

emm :P
tambien mi primera ves en que ayudo a alguien xD

bueno mira eso es facil :P
me pregunto??? tas asiendo un editorm de batchs: P
yo tbm ise uno :P
y pss le agrege la opcion de "Testear Bat"
:P mira
lo unico que tienes que hacer es
que al momento de guardar el .Bat
guarde la direccion de donde se guardo
usando un CommonDialog1
y un label :P

Al Momento de guardar el archivo digamos asi:

Código:
  With Commondialog
   .CancelError = True
      .DialogTitle = "Guardar Archivo"
      .Filter = Formatos2   
      .ShowSave
      If .FileName = "" Then Exit Sub
        If .FilterIndex = 2 Then
            RichTextBox.SaveFile .FileName
        Else
            RichTextBox.SaveFile .FileName, rtfText
            
                  Label1.Caption = .FileName
Label3.Caption = .FileTitle

      End If
   End With
Asi Yo Lo Tengo, Utilizo Un RichTextBox

Lo Que Tienes Que Agregarle Por Si Lo Tienes Digamos

Código:
Label1.Caption = CommonDialog1.FileName
Lo Que Es .Filename
Hace Que El Label1 Guarde La Direccion Del Bat :P

Ahora, Creamos Un Boton
Y Le Pondremos Esto:

Código:
Dim res As Long
If Label1.Caption = "" Then
MsgBox ("Porfavor, Busca La Direccion Del Archivo (.bat) Que Desea Testear.")
Else
 res = ShellExecute(Me.hwnd, "Open", Label1.Caption, "", "", 1)
 End If
Bueno Y Si Quieres Que Al Momento De Dale Click A Testear Bat
Que Lo Guarde... Pss Agrega:

Código:
'Guardar
With Commondialog
            RichTextBox.SaveFile .FileName, rtfText
   End With
'Guardar
Quedaria Asi:

Código:
'Guardar
With Commondialog
            RichTextBox.SaveFile .FileName, rtfText
   End With
'Guardar


Dim res As Long
If Label1.Caption = "" Then
MsgBox ("Porfavor, Busca La Direccion Del Archivo (.bat) Que Desea Testear.")
Command4.Enabled = False
Else
 res = ShellExecute(Me.hwnd, "Open", Label1.Caption, "", "", 1)
 End If
Te Recomiendo Que Uses El Richtextbox :P
y si lo usas pss :D
te funcionara de maravilla
alguna duda mandame un pm :)
adios...