AVInfo Sistemas Posted July 30, 2013 Report Share Posted July 30, 2013 BOA TARDE ESTOU TENTANDO EXECUTAR PELO MEU PROGRAMA UM .BAT EM OUTRA PASTA NAO CONSIGO NEM COM WINEXEC( E NEM COM WAITRUN( ALGUEM SABE COMO POSSO FAZER ISSO ? Quote Link to comment Share on other sites More sharing options...
sambomb Posted July 30, 2013 Report Share Posted July 30, 2013 Posta o código Quote Link to comment Share on other sites More sharing options...
AVInfo Sistemas Posted July 30, 2013 Author Report Share Posted July 30, 2013 WINEXEC("C:\ECFMAX\ECF\ESTRU.BAT") Quote Link to comment Share on other sites More sharing options...
Yury Posted July 30, 2013 Report Share Posted July 30, 2013 Olá use RUN // The example executes the DIR command, directs its output into // a file and displays the result with Notepad.exe PROCEDURE Main LOCAL cCommand := "Notepad.exe files.lst" CLS ? "DIR command" RUN dir > files.lst ? "Executing Notepad.exe" RUN (cCommand) ? "Done" RETURN Abraço Quote Link to comment Share on other sites More sharing options...
fladimir Posted July 30, 2013 Report Share Posted July 30, 2013 O Run resolve mais vai aparecer a janela do prompt de comando se quiser que não apareça use o código abaixo: /* O WScript.WSHShell O WSHShell é um objeto que permite acesso direto ao shell do Windows. Ele possui métodos e propriedades básicas para a criação de qualquer script, como executar programas, modificar o registro, gerar eventos no log de eventos do computador, entre outros. Para se familiarizar com o conteúdo que veremos adiante, recomendo que leia as informações sobre os métodos e propriedades do objeto WSHShell no link abaixo: http://msdn.microsoft.com/library/en-us/script56/html/wsoriWshShellObjectPropMeth.asp Foram adicionados dois parâmetros ao método Run, separados por vÃrgula. O primeiro parâmetro, um zero, abre o programa como uma janela escondida. O segundo parâmetro, true, faz com que o script espere até o programa ser terminado. Esses e outros parâmetros estão no seguinte link: http://msdn.microsoft.com/library/en-us/script56/html/wsoriWshShellObjectPropMeth.asp */ *************************** Function MYRUN( cComando ) *************************** Local oShell, RET, lOk:=.T. TRY #IFDEF __XHARBOUR__ oShell := CreateObject( "WScript.Shell" ) #ELSE oShell := Win_OleCreateObject( "WScript.Shell" ) #ENDIF CATCH TRY #IFDEF __XHARBOUR__ oShell := CreateObject( "WScript.Shell" ) #ELSE oShell := Win_OleCreateObject( "WScript.Shell" ) #ENDIF CATCH lOk:=.F. END END IF lOk TRY oShell:Run( "%comspec% /c " + cComando, 0, .T. ) //.F. = Nao espera a aplicacao fechar, .T. espera. CATCH lOk:=.F. END oShell := NIL ENDIF //-- RET := oShell:Run( "%comspec% /c " + cComando, 0) //, .T. ) RETURN lOk Essa função não é de minha autoria, mas foi disponibilizada no Fórum do Toledo, agradecimentos ao autor... []´s Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.