The “battle against communism” completely shaped American policy during the Cold War. It was the basis of all American foreign policy. There were a number of ways in which this was so.
First, the battle against communism led to the policy of containment. It was American policy to try to stop the spread of communism wherever it appeared to be happening. This led, for instance, to such things as the Korean War and the Vietnam War.
Second, the battle against communism led the US to give a great deal of aid to various foreign countries. A prime example of this was the Marshall Plan. In other instances, aid was given to countries in the “Third World” in an attempt to draw them closer to the US politically.
Finally, the battle against communism led the US to support essentially any regime that would declare itself to be anti-communist. This included regimes that were not very democratic and/or which abused their citizens. The worst example of this might be the apartheid regime in South Africa.
In all of these ways, the battle against communism shaped US foreign policy during the Cold War.