I have an executable file at location D:/a.exe. I changes its extension to a.txt. Now I would like to execute it using c program. i am following c code.
#include<windows.h>
system("start D:/a.txt");
// or
system("D:/a.txt");
The program doesn't execute it but open it into Notepad. How do I execute a.txt which is in reality is an executable file?
CreateProcess.CreateProcessWon Windows and theexecfamily of functions on Unix.systemuses the command interpreter that's set in theCOMSPECenvironment variable. The default is cmd, which always triesCreateProcessbefore falling back onShellExecuteEx, so it should work; it does for me in Windows 7.