Set is looking for a defined variable; "drive" is not defined in the command shell environment. You will have to create your variablename first, so at the head of your batchfile put this line:
set varname=drive
And it should then accept the set drive=x: lines.
Oh, and be careful of spaces - any after the = are part of the name.
You do realise that this will not be permanent? Your newly created variable "drive" will only exist in the current shell environment - you close it and it is gone.