Problema de ejecucion de .bat y de scripts
(1/1)
jlewis09:
Hola,
Tengo un problema quiero ejecutar un script VBS que abre puertos en un modem:
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "telnet 192.168.1.254", 9
WScript.Sleep 500
WshShell.SendKeys "TELMEX"
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "0F15AF5A01"
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "wireless ifconfig state=enabled"
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "saveall"
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "exit"
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "Timeout 15"
WshShell.SendKeys "{ENTER}"
Esto lo hago a traves de un archivo .bat
cscript "Modem.vbs"
Timeout 20
y lo llamo en visual con
Dim psi As New ProcessStartInfo("Modem.bat")
psi.WorkingDirectory = "J:\Sourcesafe 2\Sentinel SMI\SentinelSMIManager\SYS_PR_SentinelSMIManager.C V\bin\Debug\ScriptsSentinelSMI"
psi.WindowStyle = ProcessWindowStyle.Maximized
Process.Start(psi)
el problema es que me sale que no encuentra el archivo especificado dentro del bat, ya intente poniendo la ruta completa del script y aun así no funciona ya probé mi script desde cmd con cscript y funciona bien, tambien ya probé dando doble click en mi archivo bat y funciona bien el problema solo es en visual no se si alguien sepa a que se debe esto.
Agradezco su tiempo por leer esto y ojala me puedan ayudar
_TTFH_3500:
Código
cscript "Modem.vbs"
Cuando ejecutas el .bat, Modem.vbs debe estar en la misma carpeta que este o en una ruta de entorno o dar la ubicacion completa.
Aunque creo que ese no es el problema ya que dices que funciona al darle doble click.
El problema debe estar en:
Cita de: jlewis09 en 17 Noviembre 2015, 18:06 pm
Código
Dim psi As New ProcessStartInfo("Modem.bat")
psi.WorkingDirectory = "J:\Sourcesafe 2\Sentinel SMI\SentinelSMIManager\SYS_PR_SentinelSMIManager.C V\bin\Debug\ScriptsSentinelSMI"
psi.WindowStyle = ProcessWindowStyle.Maximized
Process.Start(psi)
En lugar de eso puedes intentar ejecutar directamente el .bat:
Código
Set WshShell = wscript.CreateObject("WScript.Shell")
WshShell.Exec("J:\Sourcesafe 2\Sentinel SMI\SentinelSMIManager\SYS_PR_SentinelSMIManager.C V\bin\Debug\ScriptsSentinelSMI\Modem.bat")
O no usar el .bat y ejecutar directamente es script:
Código
Set WshShell = wscript.CreateObject("WScript.Shell")
WshShell.Exec("patch\Modem.vbs")
WScript.Sleep 20000
O meter el contenido de Modem.vbs en el script que llama al bat.
Por ultimo el problema puede estar en Citar
...SYS_PR_SentinelSMIManager.C V\bin...
, en el espacio entre ".C V\" o que este mal escrita la direccion.
Navegación