Windows – Running a batch file command with arguments

batchbatch filecommand linewindows

I'm creating a script to do some repetitious OpenSSL work, but cannot seem to get the batch file to execute the commands.

Once the file has navigated to the correct directory, I try running:

openssl x509 /in:in_cert.cer /inform:DER /out:out_cert.pem /outform:PEM

…but the batch file can't seem to handle it. The slash/colon approach was added after research.

The issue seems to be around the arguments, resulting in an unknown option /in:in_cert.cer error. Note that I've also tried the standard -parameter argument approach as well.

Where am I going wrong with the batch?


Update: the issue isn't in the command itself (I can run it standalone from the command line with -'s instead of /'s… it's getting the command to run within a batch file.

Best Answer

Answer for any Googlers - the issue was not in the passing of the parameters to openssl, it was in the encoding of the batch file itself.

Once I changed the encoding in my editor (Notepad++) to Windows-1252, the batch ran the commands with ease and didn't need any special /-instead-of-- approach.

Related Question