Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 04-09-2010, 06:46 PM   #1
Beta Member
 
Join Date: Apr 2010
Posts: 3
Default A Program that Automatically Copies and Opens a file

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?
__________________

trueparadox is offline   Reply With Quote
Old 04-09-2010, 07:12 PM   #2
Site Team
 
berry120's Avatar
 
Join Date: Jul 2009
Location: England, UK
Posts: 3,425
Default Re: A Program that Automatically Copies and Opens a file

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.
__________________

__________________
Save the whales, feed the hungry, free the mallocs.
berry120 is offline   Reply With Quote
Old 04-10-2010, 12:04 PM   #3
Beta Member
 
Join Date: Apr 2010
Posts: 3
Default Re: A Program that Automatically Copies and Opens a file

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
trueparadox is offline   Reply With Quote
Old 04-18-2010, 10:11 PM   #4
Daemon Poster
 
winslow33's Avatar
 
Join Date: Jul 2009
Posts: 861
Default Re: A Program that Automatically Copies and Opens a file

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
winslow33 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 05:29 AM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0