A Program that Automatically Copies and Opens a file

trueparadox

Beta member
Messages
3
I would like to write a program that automatically copies a file from a CD to the "My Documents" folder.
I'm working on making a spreadsheet available from a CD and don't want the user to have to manually save the file to their computer.

Would it also be possible to edit the program so it copies the file to "My Documents." AND opens the file from that location at the same time?

Any advice?
 
This can be accomplished pretty easily with a simple batch file (as long as the CD drive letter stays the same.)

Code:
copy D:\cdSpreadSheet.xls C:\pathToDocuments\spreadSheet.xls
start "C:\program files\pathToExcel\excel.exe" C:\pathToDocuments\spreadSheet.xls

Obviously edit the paths above as appropriate.

If you don't know what the CD drive letter is, things get slightly more complicated.
 
Thanks for the help!

This is the file I'm working with right now, is there a way to modify it so the program gets launched? The one below works great for copying it but not for opening it.

@echo off
echo Copying Files from CD...
echo Please Wait...
::variables
set cdcopy=xcopy /s /c /e /h /i /r /y /d
set dest=%userprofile%\My Documents
set files=\Location\onCD\file.xls

%cdcopy% "D:\%files%" "%dest%\"
%cdcopy% "E:\%files%" "%dest%\"
%cdcopy% "F:\%files%" "%dest%\"
%cdcopy% "G:\%files%" "%dest%\"
%cdcopy% "H:\%files%" "%dest%\"
%cdcopy% "I:\%files%" "%dest%\"
%cdcopy% "J:\%files%" "%dest%\"
%cdcopy% "K:\%files%" "%dest%\"
%cdcopy% "L:\%files%" "%dest%\"
%cdcopy% "M:\%files%" "%dest%\"
%cdcopy% "N:\%files%" "%dest%\"
%cdcopy% "O:\%files%" "%dest%\"
%cdcopy% "P:\%files%" "%dest%\"
%cdcopy% "Q:\%files%" "%dest%\"
%cdcopy% "R:\%files%" "%dest%\"
%cdcopy% "S:\%files%" "%dest%\"
%cdcopy% "T:\%files%" "%dest%\"
%cdcopy% "U:\%files%" "%dest%\"
%cdcopy% "V:\%files%" "%dest%\"
%cdcopy% "W:\%files%" "%dest%\"
%cdcopy% "X:\%files%" "%dest%\"
%cdcopy% "Y:\%files%" "%dest%\"
%cdcopy% "Z:\%files%" "%dest%\"

cls
echo Copy Complete...
Exit
 
Might want to specify that batch file on the CD in an 'autorun.INF' file on the CD, if you want it to copy automatically when the CD is inserted
 
Back
Top Bottom