通过php中的imagemagick通过exec读取icc-profile

I am trying to use the imagemagick identify -format to read what icc-profile an image has. I use php on a Windows server.

I use the following command:

identify -format "%[profile:icc]" image.jpg > file.txt

If I run it in command-line it works and saves the icc-profile name to the file.txt.

But when I try to do the same thing in php with exec I get an empty file:

exec('identify -format "%[profile:icc]" image.jpg > file.txt');

I have tried -format with other attributes that work, like:

exec('identify -format "%[size]" image.jpg > file.txt');