This works using the DependencyInjection component. DI is what you're looking for!
When using symfony2 standard if you extend ContainerAwareCommand - symfony will inject the container automatically ...
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
class MyCommand extends ContainerAwareCommand
.. configure container-parameters in parameters.yml or config.yml
parameters:
my_parameter: my_value
then access your container-parameters using
$this->container->getParameter('my_parameter')
This way you can access those parameters from any "service" in your application as long as you have access to the container. You can even inject only the parameters which is advised as injecting the whole container is costly in terms of performance and makes testing harder.