Computing.Net > Forums > Programming > waiting batch file ???

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

waiting batch file ???

Reply to Message Icon

Original Message
Name: batchboy
Date: January 5, 2008 at 15:38:56 Pacific
Subject: waiting batch file ???
OS: win xp
CPU/Ram: 2.2 Ghz Duo 2 GB ram
Model/Manufacturer: Dv9000 Pavilion HP
Comment:

Is it possible to code a batch file that will wait in the background or something like that, and when a usb is plugged in, it uploads data onto that usb??



Report Offensive Message For Removal


Response Number 1
Name: Razor2.3
Date: January 5, 2008 at 18:11:09 Pacific
Reply: (edit)

Yeah probably, unless by "wait in the background" you mean "hide while waiting," in which case, probably not.


Report Offensive Follow Up For Removal

Response Number 2
Name: klint
Date: January 6, 2008 at 12:38:20 Pacific
Reply: (edit)

I understand the "proper" way to do it is not to have a running batch file that sits and waits, but to use a removable drive insertion handler (or whatever its proper name is) that automatically runs your batch file (or any other program) whenever the USB drive is plugged in.

I'm not sure of the details - you'll have to google for them yourself. But what I mean is, when you insert your USB drive, you often get a dialog box asking what you want to do: launch Explorer, download pictures, copy files, or nothing? Well, in that dialog box you can register your own application (probably through the Registry, but not sure how.) The advantage of that is you don't have a batch file running all the time when you don't need it, eating up memory and CPU time, but instead you have it run exactly when you want it to.


Report Offensive Follow Up For Removal

Response Number 3
Name: tonysathre
Date: January 7, 2008 at 05:09:40 Pacific
Reply: (edit)

If you have a U3 flash drive, you could use an autorun.inf file to call your script.

"Computer security." — Oxymoron


Report Offensive Follow Up For Removal

Response Number 4
Name: klint
Date: January 7, 2008 at 05:46:38 Pacific
Reply: (edit)

Tony: Good suggestion. I hate U3 drives or any other kind of smart drive, but fortunately I think the autorun.inf should work on ordinary drives too.


Report Offensive Follow Up For Removal

Response Number 5
Name: JRell
Date: January 7, 2008 at 12:32:36 Pacific
Reply: (edit)

It's not too bad... I use a tool to move my digital photos when I mount my memory card or direct attach a camera (that mounts as a disk drive) called DIM - Digital Image Mover. Here are the instructions to do just what you ask, but for his application.. just substitute your batch file for his app:

http://www.alanlight.com/dim/DIMAut...



Report Offensive Follow Up For Removal


Response Number 6
Name: tonysathre
Date: January 7, 2008 at 13:42:48 Pacific
Reply: (edit)

An autorun.inf is more portable than having to install software to get it to work. I'd go that route, but that's just me.

"Computer security." — Oxymoron


Report Offensive Follow Up For Removal

Response Number 7
Name: Razor2.3
Date: January 7, 2008 at 18:37:58 Pacific
Reply: (edit)

I don't know. Autorun.inf might be only slightly more portable. Autorun on USB is disabled by default on Win2K down, and WinXP/Vista will ask you if you want to run the autorun.inf.


Report Offensive Follow Up For Removal

Response Number 8
Name: wille
Date: January 19, 2008 at 03:31:14 Pacific
Reply: (edit)

maybe you could use this, I'm not saying it's a good solution but have worked every time I've had to use such a program;
echo off
color a
:1
cls
if exist F: (
start F:
cls
exit
)
goto 1
because then it'll check if the F: drive exists over and over again untill it does!
And then you could compile it to an executable as a ghost app.


Report Offensive Follow Up For Removal






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home








Do you have your own blog?

Yes
No
I did before
I will soon


View Results

Poll Finishes In 4 Days.
Discuss in The Lounge
Poll History




Data Recovery Software