Adicionando "CMD /C" à frente do comando
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "cmd /c SCHTASKS /QUERY > winning.txt"
Pergunta
Aqui está o código que eu tenho atualmente:
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "SCHTASKS /QUERY > winning.txt"
Na minha cabeça, isso deve funcionar corretamente e funciona sem erros, mas o arquivo de texto não é atualizado.
O arquivo de texto já foi criado, então não preciso me preocupar em criar a variável WScript
EDITAR:
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "cmd /c SCHTASKS /QUERY > winning.txt"
Obrigado David! Eu estava olhando para essas duas linhas por horas!
Solução
Adicionando "CMD /C" à frente do comando
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "cmd /c SCHTASKS /QUERY > winning.txt"