2

I'd like to run a given Perl script whenever I connect my camera to my PC, so that this script will download all the photos on it. But as the drive letter for the camera may change depending on what's already connected, I need to pass this drive letter as an argument to the script.

Is this possible?

2 Answers 2

1

As I wrote in your other question for this problem also USBDLM could be the solution. E.g. it could start your photo sync tool on connect or any script you like.

You can use the %DriveLetter% variable to be passed to your script. Here is an example configuration section:

[OnArrival1]
open=your_script.bat %DriveLetter%

See the documentation for details (the included Windows documentation is much more readable).

2

You could:

  1. Assign a different drive letter, then it will stay the same. This can be done in devmgmt.msc

  2. Instead of a drive letter, assign a filesystem path (like in Linux).

    For example, "C:\Users\Xavier\Desktop\USB key\" instead of "E:\". Again, devmgmt.msc

  3. Run mountvol, copy the \\?\Volume{blah-blah} path, replace the ? with a period . and use that path instead.

    For example, \\?\Volume{e095d6a2-a763-11dd-afc0-806d6172696f}\boot.ini in my computer is the same as C:\boot.ini. (Not sure if this remains static all the time - but it worked for me so far.)

2
  • The '\\?\Volume{blah-blah}' is a nice trick I did not know... But is it possible to have Windows give it to a script when the drive is inserted? Jul 31, 2009 at 13:27
  • I doubt it's possible to automatically run a script at all. Jul 31, 2009 at 13:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .