I am writing a Installscript function to run a command in command prompt, redirect the result from console to a text file, then read the text file for information.
// send command method
STRING szCmdPath, szCmdLine ;
szCmdPath = "C:\\WINDOWS\\system32\\cmd.exe";
szCmdLine = "/c wslconfig /l > D:\\output.txt";
LaunchAppAndWait(szCmdPath, szCmdLine, WAIT);
the send command method did not run the command with szCmdLine as I desired, it failed to recognize the command and produce the following error:
'wslconfig' is not recognized as an internal or external command, operable program or batch file.
However, if I start cmd.exe manually instead of using my script, it runs the command perfectly fine. What is wrong with my script and how to fix these problems? Thank you all in advance.