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 have the code:
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "cmd /k ""C:\ProgramTHISSTRING Files (x86)\Folder\File.bat"" > ""C:\Program Files(x86)\Folder\File.txt""", 1, True
(I do have the code to do this more elegantly but for the purpose of the problem, I think this reads better and quicker)
Also I have put in THISSTRING on purpose for the error below.
Once this executes I get this error in CMD
'C:\ProgramTHISSTRING' is not recognized as an internal or external command, operable program or batch file.
I understand it's a space in the file name that has caused the error, however, I have the right quotes according to this stackoverflow question so why is this error happening?