Much as I like touring the world with my trusty flash drive...
September 17, 2014 7:19 PM   Subscribe

How do I turn ten text files into an AutoRun file?

I need to provide a set of ~10 small text files to other departments (off-site) in my company. These 'text files' have non- TXT extensions; they actually are small programs that run a proprietary instrument, but really they are just 20-50 lines of text each. So these files need to be copied faithfully and to exactly the right location. Right now, I am often personally traveling to the site and copy/pasting the files to the right place on the hard drive because that is honestly the simplest way to do it. There's got to be an easier way.

Can't I rig up a CD or flashdrive that will have an Autorun file, which will automatically copy past these files where they need to go? It would be awesomer if the Autorun makes some sort of log that can be returned to me, so I can record that things were done properly.

Difficulty: I am a biochemist by training with only a dabbling of any programming experience, and it would be in BASIC and FORTRAN. I also am old enough to be familiar with basic DOS commands. I am good at following directions, but I have no idea where to find these directions....
posted by Tandem Affinity to Computers & Internet (9 answers total)
 
I'm on a phone so I can't give more details, but you can definitely do this with old-school DOS batch files. Just googling for batch files might give you enough of the basics to do what you need.
posted by stopgap at 7:28 PM on September 17, 2014 [1 favorite]


If I'm not mistaken, Windows no longer allows autorun by default. There's too much of a security risk. Though it can be enabled, it's still a manual process that has to be performed by your client by an admin with the knowledge to do so.

Since someone is going to be physically inserting the CD / stick, is there a reason why you can't just create a simple 'runme' batch file and instruct the user to just run that file?
posted by SquidLips at 7:30 PM on September 17, 2014


Are the computers on the site networked? If so, you may be able to use a remote-desktop program to login to these machines remotely, copy your file, and perform any other tasks you need to do. Bonus: you can make sure that the program ran correctly and you got the results you expected.
posted by lenny70 at 7:35 PM on September 17, 2014


The first thought I would have is to zip up the files and then create a batch file that would copy them as needed, assuming that "the right location" is the same in each location, given its network mappings. A batch file can be run from Windows Explorer. No feedback to you, though.
posted by yclipse at 7:39 PM on September 17, 2014


Response by poster: I do think that a 'batch file' is what I'm looking for, but I'm still struggling a little since I don't know most commands. I will experiment.

The other computers are sometimes networked, but we have had issues with permissions for remote logins; these computers are often on hospital networks and in countries with variable access laws I guess.

The "right location" is exactly the same every time. The computers are identical models, setups, etc. and fresh from the factory.

OK, done with the threadsitting; hope that clarifies.
posted by Tandem Affinity at 7:43 PM on September 17, 2014


Best answer: Even if you could get autorun to work, you would still need a batch file to call though. Autorun is only there to call an executable (.exe, .bat, etc.), and there's no point in creating some complicated thing resulting in a compiled executable when all you really seem to need to do is copy a bunch of files around.

Consider a usb drive with a batch file and one directory containing all your files. Your batch file would simply look like this:

copy .\myfolder\file1 c:\my\destination\file1 > c:\my\destination\results.log
copy .\myfolder\file2 c:\my\destination\file2 >> c:\my\destination\results.log
.
.
copy .\myfolder\file10 c:\my\destination\file1 >> c:\my\destination\results.log

The user runs the batch file and you simply ask them to e-mail you back the results.log file. That's about the simplest way I would envision you could get this done in the absence of some sort of network-based push functionality.
posted by SquidLips at 8:19 PM on September 17, 2014 [3 favorites]


You might be able to get information on the success of each install by bundling blat.exe on your flash drive, calling it from a batch file, and having it email you a log file containing the installation results. Obviously if the target computer isn't networked at all this won't work but it shouldn't require special privileges.
posted by harkin banks at 8:19 PM on September 17, 2014


SquidLips has it. KISS ftw.

as a final line, include:

echo immediately email results.log to Tandem Affinity as an attachment at tandemAffinitysWorkEmail@work.com

name the file something unmistakable like:

theSpecialFileFromTandemAffinityThatYouMustDoubleClick.bat

>>The user runs the batch file...

is just the user double-clicks the file
posted by j_curiouser at 11:33 PM on September 17, 2014


Best answer: To build on SquidLips, autoruns are kind of frowned upon, but this might help ease the pain. Ideally, whoever looks after all these computers would be able to push a policy update that will temporarily allow autoruns while you do this, then revert them back to off by default when done.

Create an empty text file at the root of the USB drive called autorun.inf, copy/paste the following into it, and edit as necessary:
[autorun]
icon=%SystemRoot%\system32\SHELL32.dll, 24
label=AppName Important-Files-To-Copy Source Drive

action=Copy the important files to their required locations.
action=@%SystemRoot%\system32\SHELL32.dll, 24

open=batchfile.bat
shellexecute=batchfile.bat

shell\copyappfiles\command=batchfile.bat
shell\copyappfiles=Copy ImportantApp Files
shell=copyappfiles

I'm unable to test at the moment, but something like that autorun.inf file should try to automatically run batchfile.bat (also in the USB root), or failing that, present the "What do you want to do with this drive?" Windows dialog. That window should have your custom "Copy the important files..." action selected as default, and just hitting enter will run the batch file. In theory, the 'shell' lines also add right-click functionality to the drive in Explorer. Whether any of that works will depend on Windows version and how Autoruns are configured.

As for the batch script, along with the ideas given, you should be able to use something like
START mailto:someone@yourdomain.com?subject=ImportantApp%%20copy%%20log%%20for%%20%COMPUTERNAME%&body=%%20%DATE%,%%20%TIME%,%%20%BODY%
in your script to take care of the mail, populating the %BODY% with the logfile contents (I don't think mailto handles attachments well, but don't know how to read in a text file - some googling should get you to where you can configure it for your needs).

Good luck!
posted by quinndexter at 3:21 AM on September 18, 2014 [1 favorite]


« Older Large electric heating pad for my pregnant wife?   |   Cartoons easy, poetry hard - New Yorker poems for... Newer »
This thread is closed to new comments.