set _JAVA_OPTIONS=-Xmx2G -Xms2G
java -jar Your minecraft or server jar.jar
Replace Xmx and Xms values with your desired allocations and save the .bat file to where you are running the server from.
to use this with single player change the line java -jar server.jar to:
java -jar Minecraft.exe
then put the batch file in the same place as Minecraft.exe (the normal launcher with the cube icon)
It's possible you may have to fiddle around with the setx command to make permanent changes to environment variables but the above batch file should work by overriding the _JAVA_OPTIONS variable for the duration of the CMD session