Windows - automatic backup of usb drives












1















I'm very prone to lose usb dongles, I want now to configure windows 'scheduled task' that each time it sees an event with 'insertion' of my drive it copys all the content in a specific folder (c>usb_backups<UUID><today's date>)



Now I'm tracking event 2003 (usb drive mount) that contains the ID, but I'm not able to discover on wich drive letter the drive is mounted on.



The script invoked should be something like:



@xcopy /E /C /Q /H /Y %%sourcedrive%% %systemdrive%usb_backups%%UUID%%%%date%%


But, right now, I don't know how to set %%sourcedrive%% and %%UUID%% variables.










share|improve this question

























  • How does the loose usb dongle factor in? Does the drive get disconnected & subsequently corrupts it's filesystem? Maybe a more robust filesystem or settings would better help. And does xcopy only copy changed files, like rsync? Or changed parts of big files? Could be a lot of copying otherwise

    – Xen2050
    Feb 25 at 10:22













  • sorry for the typo: I just put a 'extra' o

    – DDS
    Feb 25 at 10:32













  • I just copy all the files each time... It's a personal pendrive I take with me with few important text files so copying all is feasable. Eventually I'll manually delete un-needed directories

    – DDS
    Feb 25 at 10:49













  • You could try USBDLM, it's a very handy utility and will exactly suit in your case

    – montonero
    Feb 25 at 11:41
















1















I'm very prone to lose usb dongles, I want now to configure windows 'scheduled task' that each time it sees an event with 'insertion' of my drive it copys all the content in a specific folder (c>usb_backups<UUID><today's date>)



Now I'm tracking event 2003 (usb drive mount) that contains the ID, but I'm not able to discover on wich drive letter the drive is mounted on.



The script invoked should be something like:



@xcopy /E /C /Q /H /Y %%sourcedrive%% %systemdrive%usb_backups%%UUID%%%%date%%


But, right now, I don't know how to set %%sourcedrive%% and %%UUID%% variables.










share|improve this question

























  • How does the loose usb dongle factor in? Does the drive get disconnected & subsequently corrupts it's filesystem? Maybe a more robust filesystem or settings would better help. And does xcopy only copy changed files, like rsync? Or changed parts of big files? Could be a lot of copying otherwise

    – Xen2050
    Feb 25 at 10:22













  • sorry for the typo: I just put a 'extra' o

    – DDS
    Feb 25 at 10:32













  • I just copy all the files each time... It's a personal pendrive I take with me with few important text files so copying all is feasable. Eventually I'll manually delete un-needed directories

    – DDS
    Feb 25 at 10:49













  • You could try USBDLM, it's a very handy utility and will exactly suit in your case

    – montonero
    Feb 25 at 11:41














1












1








1








I'm very prone to lose usb dongles, I want now to configure windows 'scheduled task' that each time it sees an event with 'insertion' of my drive it copys all the content in a specific folder (c>usb_backups<UUID><today's date>)



Now I'm tracking event 2003 (usb drive mount) that contains the ID, but I'm not able to discover on wich drive letter the drive is mounted on.



The script invoked should be something like:



@xcopy /E /C /Q /H /Y %%sourcedrive%% %systemdrive%usb_backups%%UUID%%%%date%%


But, right now, I don't know how to set %%sourcedrive%% and %%UUID%% variables.










share|improve this question
















I'm very prone to lose usb dongles, I want now to configure windows 'scheduled task' that each time it sees an event with 'insertion' of my drive it copys all the content in a specific folder (c>usb_backups<UUID><today's date>)



Now I'm tracking event 2003 (usb drive mount) that contains the ID, but I'm not able to discover on wich drive letter the drive is mounted on.



The script invoked should be something like:



@xcopy /E /C /Q /H /Y %%sourcedrive%% %systemdrive%usb_backups%%UUID%%%%date%%


But, right now, I don't know how to set %%sourcedrive%% and %%UUID%% variables.







windows-10 batch-file windows-task-scheduler events






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 25 at 10:32







DDS

















asked Feb 25 at 10:04









DDSDDS

487311




487311













  • How does the loose usb dongle factor in? Does the drive get disconnected & subsequently corrupts it's filesystem? Maybe a more robust filesystem or settings would better help. And does xcopy only copy changed files, like rsync? Or changed parts of big files? Could be a lot of copying otherwise

    – Xen2050
    Feb 25 at 10:22













  • sorry for the typo: I just put a 'extra' o

    – DDS
    Feb 25 at 10:32













  • I just copy all the files each time... It's a personal pendrive I take with me with few important text files so copying all is feasable. Eventually I'll manually delete un-needed directories

    – DDS
    Feb 25 at 10:49













  • You could try USBDLM, it's a very handy utility and will exactly suit in your case

    – montonero
    Feb 25 at 11:41



















  • How does the loose usb dongle factor in? Does the drive get disconnected & subsequently corrupts it's filesystem? Maybe a more robust filesystem or settings would better help. And does xcopy only copy changed files, like rsync? Or changed parts of big files? Could be a lot of copying otherwise

    – Xen2050
    Feb 25 at 10:22













  • sorry for the typo: I just put a 'extra' o

    – DDS
    Feb 25 at 10:32













  • I just copy all the files each time... It's a personal pendrive I take with me with few important text files so copying all is feasable. Eventually I'll manually delete un-needed directories

    – DDS
    Feb 25 at 10:49













  • You could try USBDLM, it's a very handy utility and will exactly suit in your case

    – montonero
    Feb 25 at 11:41

















How does the loose usb dongle factor in? Does the drive get disconnected & subsequently corrupts it's filesystem? Maybe a more robust filesystem or settings would better help. And does xcopy only copy changed files, like rsync? Or changed parts of big files? Could be a lot of copying otherwise

– Xen2050
Feb 25 at 10:22







How does the loose usb dongle factor in? Does the drive get disconnected & subsequently corrupts it's filesystem? Maybe a more robust filesystem or settings would better help. And does xcopy only copy changed files, like rsync? Or changed parts of big files? Could be a lot of copying otherwise

– Xen2050
Feb 25 at 10:22















sorry for the typo: I just put a 'extra' o

– DDS
Feb 25 at 10:32







sorry for the typo: I just put a 'extra' o

– DDS
Feb 25 at 10:32















I just copy all the files each time... It's a personal pendrive I take with me with few important text files so copying all is feasable. Eventually I'll manually delete un-needed directories

– DDS
Feb 25 at 10:49







I just copy all the files each time... It's a personal pendrive I take with me with few important text files so copying all is feasable. Eventually I'll manually delete un-needed directories

– DDS
Feb 25 at 10:49















You could try USBDLM, it's a very handy utility and will exactly suit in your case

– montonero
Feb 25 at 11:41





You could try USBDLM, it's a very handy utility and will exactly suit in your case

– montonero
Feb 25 at 11:41










1 Answer
1






active

oldest

votes


















2














It appears that USBDLM would work great, it describes itself as:




USBDLM is a Windows service that gives control over Windows' drive letter assignment for USB drives. Running as service makes it independent of the logged on user's privileges, so there is no need to give the users the privilege to change drive letters.



It automatically solves conflicts between USB drives and network or subst drives of the currently logged on user.



Furthermore you can define new default letters for USB drives and much more.



It works on Windows XP to Windows 10.




It's html help page [apparently translated from German?] says you can do things like one of these to copy files with a click, or automatically:





  • let show an balloontip on drive arrival which shows the assigned drive letter

  • run something on click on the balloontip

  • executing an autorun, also depending on the criterions mentioned above




It's settings are either in an .INI file, or the registry




The desired drive letters or mount points and other settings are defined in a text file called USBDLM.INI located in the same place as the USBDLM.EXE.



Modern applications often store their settings in the Windows registry but I don't like that. INI files are the 'classic' approach.



...



Settings in the Registry:



Since V3.3.1 USBDLM can read its settings from the registry too. It reads from

HKLM/Software/Uwe Sieber/USBDLM



If this registry key exists, then the USBDLM.INI is ignored! Only the log file settings are read from the INI then.







Actions on click on the Balloontip



Similar to autorun events you can define actions on left, right and
middle click on the balloon.



;on left click, open a simple Explorer window with the drive
[OnBalloonClick] open="%windir%explorer" %drive%

;on right click, open a foto software [OnBalloonRClick]
open="C:Program FilesFotoSoftfotosoft.exe" %drive%


You can define several events depending on criterions as shown for
[AutoRun].







2. Global AutoRun settings in the USBDLM.INI



2.1 Triggered by volumes



Sample 2:



If the file DATA.TXT exist, copy it from the drive to C:Data



[OnArrival1]
FileExists=%drive%DATA.TXT
open="%windir%System32cmd.exe" /c copy "%drive%DATA.TXT" "C:Data"


cmd is the Windows command processor, /c means "execute command and end then", copy is a command which the cmd knows and copies files.




Also useful might be to copy files on removal, BalloonTips have on removal settings, or an autorun (possibly time limited):




AutoRun on and after Removal



In analogy to the OnArrival function USBDLM can execute a command-line when a drive is "prepared for safe removal" and after a drive has been removed.



1. On preparation for safe removal



When a USB or Firewire drive becomes "prepared for safe removal" the USBDLM can react while the drive is still available.



This should not take too long, the maximum time is 30 Seconds under XP, and 15 Seconds since Vista/Win7. But while the notification is processed, no other events can be handled. Therefore USBDLM wait up to 10 Seconds only. If the started process is still running after this time, then USBDLM rejects the removal request. Windows then says "USBDLM prevents the removal...".



Sample to copy the file c:test.txt to the folder backup on the drive to remove:



[OnRemovalRequest]
open="%windir%System32cmd.exe" /c copy "C:test.txt" %drive%backup


As in the first sample but only if the file backuptest.txt exists on the drive to remove:



[OnRemovalRequest]
FileExists=%drive%backuptest.txt
open="%windir%System32cmd.exe" /c copy "C:test.txt" %drive%backup



There's several Variables available, like these useful looking ones



Variable             Description          Sample
-------- ----------- ------
%DriveLetter% drive letter X
%Drive% drive X:
%Root% drive root X:
%DevName% device name Corsair Flash Voyager
%Label% volume label My flash drive
%Size% volume size 16 GB
%KernelName% kernel name DeviceHarddisk3DP(1)0-0+d
%PartitionName% Partition name DeviceHarddisk2Partition1
%DiskSignature% disk signature MBR 9810ABEF
%GptDiskIdGuid% GPT disk ID GUID {GUID}
%PureVolumeName% pure volume name Volume{GUID}
%DateISO% Date (yyyy-mm-dd) 2016-10-31
%Time% Time (hh:mm:ss) 12:00:00


[Thanks to montonero's comment for the idea]






share|improve this answer


























  • Thankyou, next time I will, for now I'm using synctoy (found it online few days ago)

    – DDS
    Feb 28 at 7:55












Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1409200%2fwindows-automatic-backup-of-usb-drives%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














It appears that USBDLM would work great, it describes itself as:




USBDLM is a Windows service that gives control over Windows' drive letter assignment for USB drives. Running as service makes it independent of the logged on user's privileges, so there is no need to give the users the privilege to change drive letters.



It automatically solves conflicts between USB drives and network or subst drives of the currently logged on user.



Furthermore you can define new default letters for USB drives and much more.



It works on Windows XP to Windows 10.




It's html help page [apparently translated from German?] says you can do things like one of these to copy files with a click, or automatically:





  • let show an balloontip on drive arrival which shows the assigned drive letter

  • run something on click on the balloontip

  • executing an autorun, also depending on the criterions mentioned above




It's settings are either in an .INI file, or the registry




The desired drive letters or mount points and other settings are defined in a text file called USBDLM.INI located in the same place as the USBDLM.EXE.



Modern applications often store their settings in the Windows registry but I don't like that. INI files are the 'classic' approach.



...



Settings in the Registry:



Since V3.3.1 USBDLM can read its settings from the registry too. It reads from

HKLM/Software/Uwe Sieber/USBDLM



If this registry key exists, then the USBDLM.INI is ignored! Only the log file settings are read from the INI then.







Actions on click on the Balloontip



Similar to autorun events you can define actions on left, right and
middle click on the balloon.



;on left click, open a simple Explorer window with the drive
[OnBalloonClick] open="%windir%explorer" %drive%

;on right click, open a foto software [OnBalloonRClick]
open="C:Program FilesFotoSoftfotosoft.exe" %drive%


You can define several events depending on criterions as shown for
[AutoRun].







2. Global AutoRun settings in the USBDLM.INI



2.1 Triggered by volumes



Sample 2:



If the file DATA.TXT exist, copy it from the drive to C:Data



[OnArrival1]
FileExists=%drive%DATA.TXT
open="%windir%System32cmd.exe" /c copy "%drive%DATA.TXT" "C:Data"


cmd is the Windows command processor, /c means "execute command and end then", copy is a command which the cmd knows and copies files.




Also useful might be to copy files on removal, BalloonTips have on removal settings, or an autorun (possibly time limited):




AutoRun on and after Removal



In analogy to the OnArrival function USBDLM can execute a command-line when a drive is "prepared for safe removal" and after a drive has been removed.



1. On preparation for safe removal



When a USB or Firewire drive becomes "prepared for safe removal" the USBDLM can react while the drive is still available.



This should not take too long, the maximum time is 30 Seconds under XP, and 15 Seconds since Vista/Win7. But while the notification is processed, no other events can be handled. Therefore USBDLM wait up to 10 Seconds only. If the started process is still running after this time, then USBDLM rejects the removal request. Windows then says "USBDLM prevents the removal...".



Sample to copy the file c:test.txt to the folder backup on the drive to remove:



[OnRemovalRequest]
open="%windir%System32cmd.exe" /c copy "C:test.txt" %drive%backup


As in the first sample but only if the file backuptest.txt exists on the drive to remove:



[OnRemovalRequest]
FileExists=%drive%backuptest.txt
open="%windir%System32cmd.exe" /c copy "C:test.txt" %drive%backup



There's several Variables available, like these useful looking ones



Variable             Description          Sample
-------- ----------- ------
%DriveLetter% drive letter X
%Drive% drive X:
%Root% drive root X:
%DevName% device name Corsair Flash Voyager
%Label% volume label My flash drive
%Size% volume size 16 GB
%KernelName% kernel name DeviceHarddisk3DP(1)0-0+d
%PartitionName% Partition name DeviceHarddisk2Partition1
%DiskSignature% disk signature MBR 9810ABEF
%GptDiskIdGuid% GPT disk ID GUID {GUID}
%PureVolumeName% pure volume name Volume{GUID}
%DateISO% Date (yyyy-mm-dd) 2016-10-31
%Time% Time (hh:mm:ss) 12:00:00


[Thanks to montonero's comment for the idea]






share|improve this answer


























  • Thankyou, next time I will, for now I'm using synctoy (found it online few days ago)

    – DDS
    Feb 28 at 7:55
















2














It appears that USBDLM would work great, it describes itself as:




USBDLM is a Windows service that gives control over Windows' drive letter assignment for USB drives. Running as service makes it independent of the logged on user's privileges, so there is no need to give the users the privilege to change drive letters.



It automatically solves conflicts between USB drives and network or subst drives of the currently logged on user.



Furthermore you can define new default letters for USB drives and much more.



It works on Windows XP to Windows 10.




It's html help page [apparently translated from German?] says you can do things like one of these to copy files with a click, or automatically:





  • let show an balloontip on drive arrival which shows the assigned drive letter

  • run something on click on the balloontip

  • executing an autorun, also depending on the criterions mentioned above




It's settings are either in an .INI file, or the registry




The desired drive letters or mount points and other settings are defined in a text file called USBDLM.INI located in the same place as the USBDLM.EXE.



Modern applications often store their settings in the Windows registry but I don't like that. INI files are the 'classic' approach.



...



Settings in the Registry:



Since V3.3.1 USBDLM can read its settings from the registry too. It reads from

HKLM/Software/Uwe Sieber/USBDLM



If this registry key exists, then the USBDLM.INI is ignored! Only the log file settings are read from the INI then.







Actions on click on the Balloontip



Similar to autorun events you can define actions on left, right and
middle click on the balloon.



;on left click, open a simple Explorer window with the drive
[OnBalloonClick] open="%windir%explorer" %drive%

;on right click, open a foto software [OnBalloonRClick]
open="C:Program FilesFotoSoftfotosoft.exe" %drive%


You can define several events depending on criterions as shown for
[AutoRun].







2. Global AutoRun settings in the USBDLM.INI



2.1 Triggered by volumes



Sample 2:



If the file DATA.TXT exist, copy it from the drive to C:Data



[OnArrival1]
FileExists=%drive%DATA.TXT
open="%windir%System32cmd.exe" /c copy "%drive%DATA.TXT" "C:Data"


cmd is the Windows command processor, /c means "execute command and end then", copy is a command which the cmd knows and copies files.




Also useful might be to copy files on removal, BalloonTips have on removal settings, or an autorun (possibly time limited):




AutoRun on and after Removal



In analogy to the OnArrival function USBDLM can execute a command-line when a drive is "prepared for safe removal" and after a drive has been removed.



1. On preparation for safe removal



When a USB or Firewire drive becomes "prepared for safe removal" the USBDLM can react while the drive is still available.



This should not take too long, the maximum time is 30 Seconds under XP, and 15 Seconds since Vista/Win7. But while the notification is processed, no other events can be handled. Therefore USBDLM wait up to 10 Seconds only. If the started process is still running after this time, then USBDLM rejects the removal request. Windows then says "USBDLM prevents the removal...".



Sample to copy the file c:test.txt to the folder backup on the drive to remove:



[OnRemovalRequest]
open="%windir%System32cmd.exe" /c copy "C:test.txt" %drive%backup


As in the first sample but only if the file backuptest.txt exists on the drive to remove:



[OnRemovalRequest]
FileExists=%drive%backuptest.txt
open="%windir%System32cmd.exe" /c copy "C:test.txt" %drive%backup



There's several Variables available, like these useful looking ones



Variable             Description          Sample
-------- ----------- ------
%DriveLetter% drive letter X
%Drive% drive X:
%Root% drive root X:
%DevName% device name Corsair Flash Voyager
%Label% volume label My flash drive
%Size% volume size 16 GB
%KernelName% kernel name DeviceHarddisk3DP(1)0-0+d
%PartitionName% Partition name DeviceHarddisk2Partition1
%DiskSignature% disk signature MBR 9810ABEF
%GptDiskIdGuid% GPT disk ID GUID {GUID}
%PureVolumeName% pure volume name Volume{GUID}
%DateISO% Date (yyyy-mm-dd) 2016-10-31
%Time% Time (hh:mm:ss) 12:00:00


[Thanks to montonero's comment for the idea]






share|improve this answer


























  • Thankyou, next time I will, for now I'm using synctoy (found it online few days ago)

    – DDS
    Feb 28 at 7:55














2












2








2







It appears that USBDLM would work great, it describes itself as:




USBDLM is a Windows service that gives control over Windows' drive letter assignment for USB drives. Running as service makes it independent of the logged on user's privileges, so there is no need to give the users the privilege to change drive letters.



It automatically solves conflicts between USB drives and network or subst drives of the currently logged on user.



Furthermore you can define new default letters for USB drives and much more.



It works on Windows XP to Windows 10.




It's html help page [apparently translated from German?] says you can do things like one of these to copy files with a click, or automatically:





  • let show an balloontip on drive arrival which shows the assigned drive letter

  • run something on click on the balloontip

  • executing an autorun, also depending on the criterions mentioned above




It's settings are either in an .INI file, or the registry




The desired drive letters or mount points and other settings are defined in a text file called USBDLM.INI located in the same place as the USBDLM.EXE.



Modern applications often store their settings in the Windows registry but I don't like that. INI files are the 'classic' approach.



...



Settings in the Registry:



Since V3.3.1 USBDLM can read its settings from the registry too. It reads from

HKLM/Software/Uwe Sieber/USBDLM



If this registry key exists, then the USBDLM.INI is ignored! Only the log file settings are read from the INI then.







Actions on click on the Balloontip



Similar to autorun events you can define actions on left, right and
middle click on the balloon.



;on left click, open a simple Explorer window with the drive
[OnBalloonClick] open="%windir%explorer" %drive%

;on right click, open a foto software [OnBalloonRClick]
open="C:Program FilesFotoSoftfotosoft.exe" %drive%


You can define several events depending on criterions as shown for
[AutoRun].







2. Global AutoRun settings in the USBDLM.INI



2.1 Triggered by volumes



Sample 2:



If the file DATA.TXT exist, copy it from the drive to C:Data



[OnArrival1]
FileExists=%drive%DATA.TXT
open="%windir%System32cmd.exe" /c copy "%drive%DATA.TXT" "C:Data"


cmd is the Windows command processor, /c means "execute command and end then", copy is a command which the cmd knows and copies files.




Also useful might be to copy files on removal, BalloonTips have on removal settings, or an autorun (possibly time limited):




AutoRun on and after Removal



In analogy to the OnArrival function USBDLM can execute a command-line when a drive is "prepared for safe removal" and after a drive has been removed.



1. On preparation for safe removal



When a USB or Firewire drive becomes "prepared for safe removal" the USBDLM can react while the drive is still available.



This should not take too long, the maximum time is 30 Seconds under XP, and 15 Seconds since Vista/Win7. But while the notification is processed, no other events can be handled. Therefore USBDLM wait up to 10 Seconds only. If the started process is still running after this time, then USBDLM rejects the removal request. Windows then says "USBDLM prevents the removal...".



Sample to copy the file c:test.txt to the folder backup on the drive to remove:



[OnRemovalRequest]
open="%windir%System32cmd.exe" /c copy "C:test.txt" %drive%backup


As in the first sample but only if the file backuptest.txt exists on the drive to remove:



[OnRemovalRequest]
FileExists=%drive%backuptest.txt
open="%windir%System32cmd.exe" /c copy "C:test.txt" %drive%backup



There's several Variables available, like these useful looking ones



Variable             Description          Sample
-------- ----------- ------
%DriveLetter% drive letter X
%Drive% drive X:
%Root% drive root X:
%DevName% device name Corsair Flash Voyager
%Label% volume label My flash drive
%Size% volume size 16 GB
%KernelName% kernel name DeviceHarddisk3DP(1)0-0+d
%PartitionName% Partition name DeviceHarddisk2Partition1
%DiskSignature% disk signature MBR 9810ABEF
%GptDiskIdGuid% GPT disk ID GUID {GUID}
%PureVolumeName% pure volume name Volume{GUID}
%DateISO% Date (yyyy-mm-dd) 2016-10-31
%Time% Time (hh:mm:ss) 12:00:00


[Thanks to montonero's comment for the idea]






share|improve this answer















It appears that USBDLM would work great, it describes itself as:




USBDLM is a Windows service that gives control over Windows' drive letter assignment for USB drives. Running as service makes it independent of the logged on user's privileges, so there is no need to give the users the privilege to change drive letters.



It automatically solves conflicts between USB drives and network or subst drives of the currently logged on user.



Furthermore you can define new default letters for USB drives and much more.



It works on Windows XP to Windows 10.




It's html help page [apparently translated from German?] says you can do things like one of these to copy files with a click, or automatically:





  • let show an balloontip on drive arrival which shows the assigned drive letter

  • run something on click on the balloontip

  • executing an autorun, also depending on the criterions mentioned above




It's settings are either in an .INI file, or the registry




The desired drive letters or mount points and other settings are defined in a text file called USBDLM.INI located in the same place as the USBDLM.EXE.



Modern applications often store their settings in the Windows registry but I don't like that. INI files are the 'classic' approach.



...



Settings in the Registry:



Since V3.3.1 USBDLM can read its settings from the registry too. It reads from

HKLM/Software/Uwe Sieber/USBDLM



If this registry key exists, then the USBDLM.INI is ignored! Only the log file settings are read from the INI then.







Actions on click on the Balloontip



Similar to autorun events you can define actions on left, right and
middle click on the balloon.



;on left click, open a simple Explorer window with the drive
[OnBalloonClick] open="%windir%explorer" %drive%

;on right click, open a foto software [OnBalloonRClick]
open="C:Program FilesFotoSoftfotosoft.exe" %drive%


You can define several events depending on criterions as shown for
[AutoRun].







2. Global AutoRun settings in the USBDLM.INI



2.1 Triggered by volumes



Sample 2:



If the file DATA.TXT exist, copy it from the drive to C:Data



[OnArrival1]
FileExists=%drive%DATA.TXT
open="%windir%System32cmd.exe" /c copy "%drive%DATA.TXT" "C:Data"


cmd is the Windows command processor, /c means "execute command and end then", copy is a command which the cmd knows and copies files.




Also useful might be to copy files on removal, BalloonTips have on removal settings, or an autorun (possibly time limited):




AutoRun on and after Removal



In analogy to the OnArrival function USBDLM can execute a command-line when a drive is "prepared for safe removal" and after a drive has been removed.



1. On preparation for safe removal



When a USB or Firewire drive becomes "prepared for safe removal" the USBDLM can react while the drive is still available.



This should not take too long, the maximum time is 30 Seconds under XP, and 15 Seconds since Vista/Win7. But while the notification is processed, no other events can be handled. Therefore USBDLM wait up to 10 Seconds only. If the started process is still running after this time, then USBDLM rejects the removal request. Windows then says "USBDLM prevents the removal...".



Sample to copy the file c:test.txt to the folder backup on the drive to remove:



[OnRemovalRequest]
open="%windir%System32cmd.exe" /c copy "C:test.txt" %drive%backup


As in the first sample but only if the file backuptest.txt exists on the drive to remove:



[OnRemovalRequest]
FileExists=%drive%backuptest.txt
open="%windir%System32cmd.exe" /c copy "C:test.txt" %drive%backup



There's several Variables available, like these useful looking ones



Variable             Description          Sample
-------- ----------- ------
%DriveLetter% drive letter X
%Drive% drive X:
%Root% drive root X:
%DevName% device name Corsair Flash Voyager
%Label% volume label My flash drive
%Size% volume size 16 GB
%KernelName% kernel name DeviceHarddisk3DP(1)0-0+d
%PartitionName% Partition name DeviceHarddisk2Partition1
%DiskSignature% disk signature MBR 9810ABEF
%GptDiskIdGuid% GPT disk ID GUID {GUID}
%PureVolumeName% pure volume name Volume{GUID}
%DateISO% Date (yyyy-mm-dd) 2016-10-31
%Time% Time (hh:mm:ss) 12:00:00


[Thanks to montonero's comment for the idea]







share|improve this answer














share|improve this answer



share|improve this answer








edited Feb 28 at 21:17

























answered Feb 28 at 5:06









Xen2050Xen2050

11.3k31637




11.3k31637













  • Thankyou, next time I will, for now I'm using synctoy (found it online few days ago)

    – DDS
    Feb 28 at 7:55



















  • Thankyou, next time I will, for now I'm using synctoy (found it online few days ago)

    – DDS
    Feb 28 at 7:55

















Thankyou, next time I will, for now I'm using synctoy (found it online few days ago)

– DDS
Feb 28 at 7:55





Thankyou, next time I will, for now I'm using synctoy (found it online few days ago)

– DDS
Feb 28 at 7:55


















draft saved

draft discarded




















































Thanks for contributing an answer to Super User!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1409200%2fwindows-automatic-backup-of-usb-drives%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How do I know what Microsoft account the skydrive app is syncing to?

When does type information flow backwards in C++?

Grease: Live!