Automatically encode cmd messages