Hello
Your question miss some important informations. What kind of curve are you doing? CV, EP, bezier? What degree?
by the way here's python snippet that would help:
cmds.selectPref(trackSelectionOrder=True)
indices = cmds.ls( fl=True, orderedSelection = True)
poses= []
for index in indices:
poses.append(cmds.pointPosition(index, w=True))
cmds.curve(d=3, p=poses)
Select your cube's vertices (order matters) then launch this script and it will create a curve having its CVs snapped to the selected vertices.
second method (best one?):
Select the edges of the cube then Modify->Convert->polygon Edges to Curves