Autorun was disabled in Windows. I am looking for an alternative. I got this AutoIt script :
$DBT_DEVICEARRIVAL = "0x00008000"
$WM_DEVICECHANGE = 0x0219
GUICreate("")
GUIRegisterMsg($WM_DEVICECHANGE , "MyFunc")
Func MyFunc($hWndGUI, $MsgID, $WParam, $LParam)
If $WParam == $DBT_DEVICEARRIVAL Then
MsgBox(4096, "Info", "My Drive has been Inserted, Backup My Files!")
EndIf
EndFunc
While 1
$GuiMsg = GUIGetMsg()
WEnd
Soon as plugged in, the message box appeared. Now, to run a file I replaced
MsgBox(4096, "Info", "My Drive has been Inserted, Backup My Files!")
by
Run ("F:\path\to\my\file.cmd")
But what to change so file.cmd
can be run on computers that assign a drive letter different than F:
?