Not related to Code::Blocks, really. You have a bad Visual Studio install, or accidentially deleted some files, or accidentially changed the path or dllpath environment variables, or something worse (malware?).
I think this is not correct, because all installs of VStudio doesn't modify the env. There is a reqirement to run cl.exe (and otherd) in the modified env by using the provided scripts.
Well, Code::Blocks does not delete files from the user's computer, nor does it tamper with system library paths or environment (envvar plugin exempted). That's a pretty safe thing to assume.
Yet, the error is clear.
cl.exe doesn't run because it can't find a shared library. Which means either the DLL is not there (has been deleted, or was never installed?) or is present but can't be found or accessed for some obscure reason (bad system configuration, e.g. lib search path?).
Unless of course, if Microsoft has put extra effort into making their products un-runnable from other IDEs (requiring special magic) than their own, but I would be surprised if that was the case. Other people run the MS compiler with Code::Blocks just fine, so I guess it ought to work (I'm
not one of them, VS11 will not even install on my machine, allegedly because "user aborted install").
I install VS11 a while ago [...] started setting up the environment variables
That's my guess where the problem is.
Almost like something is loaded in the VS command prompt that isn't in the normal one.
What's possible is that maybe the VS command prompt does a sanity check to assure that the environment variables are correct (or even just sets them brute force). You should be able to find out by running Process Explorer, it lets you see the environment if you double-click any running process. Try and do that for cl.exe when you run it from Code::Blocks and when you run it from the VS command prompt. Or, try it on the command prompt directly (50% chance that this just works, too).