If compacting, I suspect that the problem is that you must issue the command using the complete path name to the mail database, which typically resides in the mail subdirectory of the server’s data directory, so:
Forgot to say: if you want to have the files actually in your Q:\ directory (for example) you can use directory links - look them up in Administrator help.