Problem with external tool and command with dollar

Answered

Hi all,

I want to create tool for stop all containers in Docker.
For that I must do :

  • docker stop $(docker ps -aq)

This command works in CMD of Windows 10.
But I can't use that for my custom tool in PhpStorm.

Result:

docker stop $(docker ps -aq)
unknown shorthand flag: 'a' in -aq)
See 'docker stop --help'.

I thing '$' is the problem, thanks for your help.

4 comments

Are you sure you're running it with CMD?
Because I got exactly same results there: http://prntscr.com/jp7tjz
Maybe you're using PowerShell, not CMD?

0

Hi Eugene and thanks for your assistance.

You have reason, I didn't know but this command works with PowerShell only.
I tried to change default terminal in PhpStorm preferences, but it isn't worked.

0

I can't check that (don't wanna reboot Windows into the Hyper-V mode), but I think that powershell -Command "docker stop $(docker ps -aq)" should do the trick.

2

Please sign in to leave a comment.