Question: I am executing a batch file in Jenkins for building a cpp code and i have a command in between to build the executable like "g++ sourcefile.cpp -o executablefile" and it gives error 'g++' is not recognized as an internal or external command.How to Resolve this??

Answer: 
When Jenkins is run as a service on a Windows machine it runs under the System account, not a user account (or your account). Therefore, you need to make sure that everything you need to setup for paths (etc.) is either done for the system account or included as part of your "Windows Batch Script" in Jenkins. (I actually use this method myself for several projects.)

To test if the System Account can do the compile, you need to open a CMD prompt as the System Account. This question should help you with taht: [How Do You Run CMD under System Account](https://stackoverflow.com/questions/77528/how-do-you-run-cmd-exe-under-the-local-system-account).
1. Install GCC and bintools
2. Set the environment variable: `PATH` of your system to the folder that contains `gcc.exe`, `g++.exe`
3. done!