Am trying to redirect output from cmd to a text file using Wscript.shell
script. It works when cmd window is in active mode. But doesn't work with cmd windows style is 0 (hidden mode).
Dim objShell : Set objShell = CreateObject("WScript.Shell")
Dim cmd : cmd = "cmd /K sftp " & sftpusername & "@" & sftpserver & " > output.txt"
Oresult = objShell.Run (cmd, 0, false)
The output file is empty. However, when I change the window style to 1, I can see the data on output file.
output.txt