$result=`.\path\command` this code makes
$result contain the
output of the command. That output is then checked by your
if. So if it is empty or if it evaluates to 0 as a number then your program prints "Unsuccessful\n".
As the others have allready stated you probably should check the $? variable - not the program output.