Yep. Do it somehow like this, after you entered your command line window:
cd C:\quake2\baseq2
pakoptimz.exe pak2.pak pak12.pak
After that, you delete the original pak2.pak (make a backup, tho

) and rename pak12.pak to pak2.pak, since it should replace the old (unoptimized) one.