0

I'd like to preface this by saying I'm not a system administrator at all, just a lowly Java programmer. However, I've been tasked with writing a batch script to be run on a sizable number of laptop computers. The script is done, but there's a catch (of course).

They want to be able to plug in a thumb drive containing the script, start it, and pull the thumb drive for the next computer but leave the script running. Oh, and for some reason, using the laptops' built-in wireless to pull the script from a shared network folder isn't an option.

I want to know if there's a good (and preferably easy) way to do this. I thought about having a script on the thumb drive copy the needed script to the hard drive then start it, but I don't know if it will work and I don't really want to leave it on the hard drive after it's done.

iandisme
  • 103
  • 4

1 Answers1

1

This is really more of a question for stack overflow I think, because these are all problems that can be solved programatically.

What I would do is:

  1. On the USB stick, create an autorun.inf that executes the bootstrapper script
  2. The bootstrapper script copies a 2nd script (the one you want to run) to the %TEMP% folder
  3. Starts a new process that executes the 2nd script
  4. Bootstrapper script stops executing
  5. Pull the USB stick out

As to how to achieve this? SO awaits! And the use of the %TEMP% folder is because it will be cleared out by the system eventually I believe.

P.S. Is your avatar the explosion from the intro movie to the original C&C game, circa 1995?

Mark Henderson
  • 68,823
  • 31
  • 180
  • 259
  • 1
    Remember that Autorun from USB doesn't work anymore as of Windows 7. – Joey Jan 05 '10 at 22:40
  • Just a note that, at least prior to Vista, Windows will not clean out the %TEMP% folder. It may cleanout some of what it puts in there itself (on a really good day) but will not clean up after other apps. – John Gardeniers Jan 05 '10 at 22:45
  • These are rental lappies from Dell so if they don't have 7 now they probably will later. I won't bother with the autorun; thanks for the idea with %TEMP% though. I'll ask on SO. Oh, and it's just a random mushroom cloud pic I found. It could be from C&C (great game) for all I know. – iandisme Jan 05 '10 at 22:47
  • @Johannes, I didn't know this, thanks for the tip. @John, I belive the Disk Cleanup wizard will empty it out, but good point. – Mark Henderson Jan 05 '10 at 22:50