Agregar "cmd /c" al frente del comando
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "cmd /c SCHTASKS /QUERY > winning.txt"
Pregunta
Aquí está el código que tengo actualmente:
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "SCHTASKS /QUERY > winning.txt"
En mi cabeza, esto debería funcionar correctamente, y se ejecuta sin errores, pero el archivo de texto no se actualiza.
El archivo de texto ya está creado, por lo que no tengo que preocuparme por crear la variable WScript
EDITAR:
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "cmd /c SCHTASKS /QUERY > winning.txt"
¡Gracias David! ¡Estaba mirando esas dos líneas durante horas!
Solución
Agregar "cmd /c" al frente del comando
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "cmd /c SCHTASKS /QUERY > winning.txt"