Page 1 of 1

Extract Subject details from certificate in Batch script

Posted: 02 Jul 2019 05:03
by dosuser97625
Hi,
I am using below command to get Subject information:
CertUtil -dump test.cer
I am getting full certificate info.

But I need to get below Subject details and use in batch script
Subject:
CN=test.co.uk
OU=test
O=test
L=test
S=test
C=GB

Can someone please help me to get only this info to make use in batch script.

-Dosuser

Re: Extract Subject details from certificate in Batch script

Posted: 08 Jul 2019 11:23
by penpen
I'm unsire if you could use a "for/f"-loop to extract that information (depends on the exact the output of your comnmand).
Could you provide a sample output (with alienated data)?

penpen