2

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?

  • 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 Answers3

3

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

  • 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
2

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.

  • 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. –  Oct 29 '09 at 12:27
0

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.