I am looking for a ( VBS or BAT or ...etc ) that I will put it in my PC (Windows). And when a USB Flash Drive is connected to my PC, this VBS will run another VBS that is located also in my PC in order to do some tasks.
Asked
Active
Viewed 2,948 times
-2
-
Joe, you will receive more useful feedback if you attempt to solve the problem, then show us what you've done to attempt to solve the problem. Asking overly broad, overly generic, or "do this for me" questions are not often well-received. – Redbeard011010 Nov 19 '16 at 19:27
-
Ok, I maked a VBS that run a batch which can copy a USB flash content to my PC, the problem is to make the VBS running automatic when the USB is connected to the PC My VBS code is : "Acting.bat" Set WshShell = CreateObject("WScript.Shell") WshShell.Run chr(34) & "Acting.bat" & Chr(34), 0 Set WshShell = Nothing And Acting.bat is: @Echo Off Echo Please Press "d" xcopy "H:\" "D:\New" /D /E /C /R /I /K /Y /H exit – Joe Wright Nov 19 '16 at 19:42
-
Follow [How to capture a USB event trace with Logman](https://msdn.microsoft.com/en-us/library/windows/hardware/jj151573(v=vs.85).aspx) or [audit USB device plugin](https://technet.microsoft.com/en-us/library/jj574128(v=ws.11).aspx) and then schedule running your VBScript (trigger on an event). – JosefZ Nov 19 '16 at 20:15
-
Did you checked this post ? ==>[Script that detect usb when it is inserted and copy files from usb to computer](http://stackoverflow.com/questions/38445884/script-that-detect-usb-when-it-is-inserted-and-copy-files-from-usb-to-computer?answertab=active#tab-top) – Hackoo Nov 20 '16 at 14:51
1 Answers
0
you can try an autorun file on your USB disk Autorunning program from CD or USB on Win7/8
you can also try the powershell procedure given at this page https://superuser.com/questions/219401/starting-scheduled-task-by-detecting-connection-of-usb-device

Community
- 1
- 1

Hemant Pathak
- 68
- 6
-
The problem is The USB disk is not reachable, we want to run the VBS immediately when the USB disk is connected to our PC. So I need something that can be executed straightly without putting anything in the USB disk – Joe Wright Nov 19 '16 at 19:38