Mayapy Interpreter Error

Working in command line ( windows 10) mayapy interpreter
Why am I getting this error?

set PYTHONPATH=%PYTHONPATH%;C:\mayapybook\pylib
^
SyntaxError: invalid syntax

That’s not Python sytax, the mayapy interpreter is a Python environment. If you want to change the PYTHONPATH then you either need to set that from the shell (in shell syntax as you have) before starting mayapy, or change it from within Python (using Python syntax).

I strongly suggest you to try out mayapy manager from @Theodox, it saves a lot if time:

e class="onebox githubgist" data-onebox-src="https://gist.github.com/theodox/2c712a91155c7e1c4c15">
gist.github.com

https://gist.github.com/theodox/2c712a91155c7e1c4c15

mayaPyManager.py
'''
Exposes the MayaPyManager class, which is used to run instances of MayaPy with explict control over paths and environment variables. A Manager can run scripts, modules, or command strings in a separate MayaPy environment; results and errors are captured and returned. 

Typical uses might be:

- running unit tests
- running a copy of Maya.standalone as a headless RPC server with StandaloneRPC https://github.com/theodox/standaloneRPC
- spawning multipe copies of maya to batch process files in parallel on a multi-core machine
- do any of the above on multiple maya versions concurrently
This file has been truncated. show original