Possible way without using any other software, assuming you're starting with a newly-formatted drive:
- Install Windows 7
- After install, go to Control Panel -> Admin Tools -> Computer Management -> Disk Management
- Shrink the partition by the amount of space you want for the second one, form a new partition with the unallocated space
- Format 2nd partition and install XP on it
How is it done with a command line?
Why don't you want to use a 3rd party partitioner? If you're doing this as an academic exercise I can appreciate that, but it isn't the easiest way.