Automatically get cmd