I get an error when I run this command and I am unsure why.
Running VBScript to execute a bat file, I want to output any error messages to a log file. So to do this I ha
I think the issue here is because the cmd /k
needs the commands passed to it to be encapsulated in double quotes.
So the command (removed THISSTRING
as you said that was just to trigger the error)
WshShell.Run "cmd /k ""C:\Program Files (x86)\Folder\File.bat"" > ""C:\Program Files(x86)\Folder\File.txt""", 1, True
Becomes
WshShell.Run "cmd /k """"C:\Program Files (x86)\Folder\File.bat"" > ""C:\Program Files(x86)\Folder\File.txt""""", 1, True
and run's as
cmd /k ""C:\Program Files (x86)\Folder\File.bat" > "C:\Program Files(x86)\Folder\File.txt""