Kenneth Fisher makes an important discovery about SQL Agent jobs running in command shell mode:
Command shell steps in SQL Agent jobs only process the first command. (Yea, I know it’s the title of the post so this wasn’t much of a surprise. You’ll live.)
In order to prove this, I created a job with a series of steps, each one a different test. I’m using two very simple commands. whoami that tells you who is running the shell (very useful if you aren’t certain) and dir which I will assume everyone knows.
Kenneth ran through several tests to see what would trigger the “first command” rule and it turns out that pretty much everything does.