I use the following Notepad++ command to compile Visual C++:
cmd /k "D:\Programs\VC\VC\Auxiliary\Build\vcvarsall.bat x86 & cd /d $(CURRENT_DIRECTORY) & cl $(FILE_NAME) & $(NAME_PART).exe"
"D:\Programs\VC" should be replaced by the path to Visual Studio Build Tools on your system; the second "VC" and what follows remains. The vcvarsall.bat script with x86 argument (the argument depends on your system) sets the necessary variables and allows the compiler to find its libraries. This script ships with Visual Studio and is adjusted to your system during its installation.
& $(NAME_PART).exe is not necessary, it runs the compiled program.
Note also that I have the directory with cl.exe on PATH.