Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

My problem is similar to Automatically copy files to USB drive when connected.

However, the path of source of the file, which is the desktop, isn't static, so I want the solution to be able to automatically detect the path of the desktop of the current user, because I want to use the USB drive on too many PCs and and I can't select the desktop or specify the path manually.

Any suggestions?

share|improve this question
    
Perhaps a portable sync program installed on the USB drive? But I think you're aiming a little high here, interesting though! +1 –  Ivo Flipse Oct 29 '09 at 12:09

3 Answers 3

up vote 3 down vote accepted

You want to use %HOMEPATH%\Desktop as your source path. I believe that is correct for XP and up.

share|improve this answer
    
Thanks, that worked :) –  Moayad Mardini Oct 29 '09 at 12:17
    
Another question, please. How can I make the destination path contains the time-date, so files from different PCs don't mix up? –  Moayad Mardini Oct 29 '09 at 12:20

Depending on Internet access/Permissions etc. have you considered using Dropbox? Cloud file storage that seamlessly integrates with Explorer/Finder and syncs files across all systems. Needs a small client install, but otherwise it's a great way to keep multiple systems up to date.

You can also install a portable version of the client called DropboxPortable onto a USB thumbstick and sync files across all accounts.

share|improve this answer

You can use %USERPROFILE%\Desktop as the path. Best of all is that this will work with the XCOPY solution, as the batch file will evaluate the environment variables.

share|improve this answer
    
What is the advantage of using %USERPROFILE%\Desktop over %HOMEPATH%\Desktop? Or are they the same thing? Thanks +1 –  Moayad Mardini Oct 29 '09 at 12:17
1  
Some applications may not allow %HOMEPATH% as it starts with a backslash when they expect a drive letter instead. %USERPROFILE% starts with C:\. Both will be fine if using XCOPY though as cmd will evaluate a backslash as the root of the drive. –  John T Oct 29 '09 at 12:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.