win2pdfd.exe pagecount "sourcefile"
Returns number of PDF pages from “sourcefile”. If the “sourcefile” file name contains spaces, it must be enclosed with quotation marks.
From the Windows CMD prompt, the page count can be referenced using the built-in %ERRORLEVEL% environment variable. This can be referenced from other Win2PDF command line options in a batch file.
From PowerShell, the page count can be referenced using $LASTEXITCODE.
Returns 0 if an error occurs.