Hi,
mayapy.exe is a Python interpreter.
The set command you wrote is a windows command.
https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/set_1
*to be more precise, %ENVIRONMENTVARIABLE% is used in bat and cmd files.
If you call a variable value from a batch file, enclose the value with percent signs (%). For example, if your batch program creates an environment variable named BAUD, you can use the string associated with BAUD as a replaceable parameter by typing %baud% at the command prompt.
if you wanna change environment variable, you should do it before you start mayapy.exe.
rem this line changes environment variables
set PYTHONPATH=%PYTHONPATH%;C:\mayapybook\pylib
rem this line starts mayapy.exe interpreter
mayapy.exe
Or, alternatively, you should change it in a inside your Python interpreter.
import os
import sys
append_path = r'C:\mayapybook\pylib'
# change environment variable
os.environ['PYTHONPATH'] = '%s;%s' % (os.environ['PYTHONPATH'], append_path)
# change sys.path
sys.path.append(append_path)
Hope it helps