Sample code for 30+ languages & platforms
VBScript

Duplicate openssl pkey -in private.pem -pubout -out pubkey.pem

See more OpenSSL Examples

How to output the public part of a private key: Demonstrates how to duplicate this OpenSSL command:
openssl pkey -in private.pem -pubout -out pubkey.pem

Chilkat VBScript Downloads

VBScript
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)

success = 0

set pkey = CreateObject("Chilkat.PrivateKey")

' Load the private key from an PEM file:
success = pkey.LoadPemFile("private.pem")
If (success = 0) Then
    outFile.WriteLine(pkey.LastErrorText)
    WScript.Quit
End If

set pubKey = CreateObject("Chilkat.PublicKey")
success = pkey.ToPublicKey(pubKey)

success = pubKey.SavePemFile(0,"pubKey.pem")
If (success <> 1) Then
    outFile.WriteLine(pubKey.LastErrorText)

    WScript.Quit
End If

outFile.WriteLine("Success.")

outFile.Close