Running a program through C++ on more than your computer?

So currently what i want this program to do is when opened will simply open another program and continue with the rest of the original program (I haven't finished that yet cause i can't get the run figured out!) Now i've got the run figured out to make a file run but yet if i give this to my friend and his PC is named Jack then it's a different path to get to desktop, so is there a command to change it to the current users name? (and yes i know if i just put it in program files or something then it excludes username in path but the thats not an option, thanks for any and all help
1
2
3
4
5
6
int main()
{
system("start C:\\User\\Justin\\Desktop\\testingrunprogram\\name.exe"); // My PC name is Justin 
return 0;
}
https://msdn.microsoft.com/en-us/library/bb762278.aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/bb762181.aspx
http://stackoverflow.com/questions/9542611/how-to-get-the-current-users-home-directory-in-windows
How would i work that into the system syntax though? to make it get the user then change the user from that one to a different one in system?
Topic archived. No new replies allowed.