Thanks, I gave that a go, and I think the problem might be the testnet-magic part now - it gives me the same error, but if I drop the testnet-magic off the end it says it needs either mainnet or testnet-magic and a number afterwards.
Latest version of my command: cardano-cli query protocol-parameters --mary-era --out-file protocol.json --testnet-magic 42