CommandContribution: Pass arguments to commands registered

I have a class such as:
`class RestApiCommandContribution implements CommandContribution {

registerCommands(commands: CommandRegistry): void {

    commands.registerCommand(MyCommands.CMD1, {
        execute: this.execute()


/* ... */


While invoking the above command MyCommand.CMD1 from another extension/class, can I pass some arguments to the command ?
How can i achieve that?

[original thread by rs]

CommandService.executeCommand(‘mycommand’, arg1, arg2, …, argn) - execute

in your handler:

execute((arg1, arg2, …, argn) => this.execute(arg1, …, argn))


thank you, @anton-kosyakov