I had created an array for commands:
String[] commands={"CHDIR C:\\Program Files (x86)\\MicroStrategy\\Command Manager","cmdmgr -n xyz -u pqr -p lmn -f C:\\Users\\Administrator\\Desktop\\Script.scp -o C:\\Users\\Administrator\\Desktop\\MyScript.log"};
It is giving me invalid -n error.
With the -n you should specify the project source name. Look in Developer or Project Source Manager if not sure which name is correct. If its a single word without spaces you can provide it as is. But if it contains spaces it has to be enclosed in double quotes like
-n "My Project Source"
. HTH!